Forum OpenACS Q&A: Javascript Popup Login

Collapse
Posted by MaineBob OConnor on

I am looking for code to do a popup.
...not just any code, Elegant code!
Here is what I'd like:

From a page open to an un-registered user
this user clicks on a link to a registered user
area, A popup box appears with the name/email/cookie
etc. request. (the /register/ page).

If errors, the message is shown in the same popup window
so that it can be corrected...(ex: 'First name required')
If successful, the popup goes away and the original full
screen browser is redirected to the registered user content.

One annoying thing about popup windows is that they
can get hidden if the main brower is clicked. It's there
but hidden and inexperienced useres don't know to click
on the task bar...

Also, you may try to convince me not to use Javascript
popups.... Will they work with 99.9% of browsers currently
in use?

-Bob

Collapse
Posted by Sam Snow on
Collapse
Posted by russ m on

We're just wrapping up a project (built on ACS4) that has a lot of important functionality in popups, including the sort of thing you describe here - you have no idea how much you don't want to go down that path... Unless your client (you?) is absolutely set on it, I'd suggest not trying to retrofit that sort of interface onto ACS.

If you're set on it, I can offer some suggestions to do what you're after, but it won't be elegant by any stretch of the imagination.

Collapse
Posted by Bob OConnor on

Well, Sam gave a great link and I learned a bit more about javascript...

Now Russell asks, "do you Really REALLY *REALLY* want to do this?"

It's really a client request, so no, not REALLY!

My Questions:

Do you recommend using only ONE window for a website, and avoid the use of multiple browser windows like...er 'adult' sites that seem to open a gazillion browser windows? It seems like there are advantages, sometimes, to opening a new window which is just a short side path and when the user closes it, the user is back to the main page...

Is javascript being used in OpenACS 4.0? If so, how and how much? It seems that some small amount of javascript may be useful, BUT I can see how it gets complex quickly. Then there is the issue of compatibility with various platforms and browsers. I love the idea of being platform and browser agnostic.

Discussion....

-Bob

Collapse
Posted by russ m on
Personally I'm from the "keep it all in one window" school,
although I can see the attractiveness of placing short
self-contained interactions in a popup window.

You can avoid the "clicked in the main window and now I've lost
the popup" situation by using IE's window.showModalDialog() to
open a window that will hold focus untill it is closed, if you're
willing to tie yourself to IE... I presume the same behaviour can
be obtained with window.setZOptions() or onBlur="focus()" type
stuff.

There are 3 solutions I can see to your particular requirement,
none of which are particularly apealing to me.

Given that opening a new window for the login sequence can be
triggered by a) clicking on a link with an appropriate onClick
handler or target attribute, or b) an onLoad handler in a page -

a) can be achieved by ensuring every link presented to the user
has been modified to do the right thing (open login popup) if the
user doesn't have correct privileges to view the target page. The
general way to do this would be to give the request processor or
templating system knowledge of what pages are potentially
restricted and have it/them rewrite links on the fly in served
pages, but it'd probably be easier to manually go through every
page that might potentially link to restricted content and add
permission-checking logic there (I wouldn't want to maintain
somethink like that). The problem with both of these aproaches
is you're requiring someone else (individual pages or
RP/templating) to know the authorization status of every page in
the site instead of allowing individual pages to make up their
own minds when actually loaded.

b) allows you to keep privilege information in a page it affects
instead of pages that link to it, but you've lost the interaction
advantage of popping up a window saying "you need to login to
do that [OK] [Cancel]" and allowing a user to not follow the link.
Your interaction is then exactly the same as the standard ACS
process, and the popup gains you nothing in useability, so why
bother?

Collapse
Posted by Pascal Scheffers on
I am, like most of us here no, not a 'typical' end user. But I have to admit that I get confused quickly when a site pops up additional screens. The *only* popup I found sofar that I kind-of like is the 'I am processing your request, please hold' like shellgeostar does.

There are other things that annoy me even more: pop up a box with 'it worked!', and just an okay button. Or even more aggravating: 'it didn't work, press reload to try again', and then, again, just an okay button - the user has to find the reload button himself...

Another problem with pop-ups is slow connections. A lot of times the main-screen has been fully loaded, images and all, before a single line in the popup shows. To make matters worse, the 'designer' has 'helped' to remove 'confusion' for the user by, erhm, changing *everything* s/he is familiar with on a browser window:

  • Navigation bar (back, fwd, home): gone
  • Location bar (http://....): gone
  • Status bar: GONE!
  • Menubar: gone
Remember, there are people out there who don't even know how to close a window with the 'X' in the top-right corner.

I like to have everything inline. Infact, most (not all) sites have a fallback when javascript doesn't work. If I want something from a site with popups, I disable javascript.

Only a 'modal' dialog for login (like basic-authentication does), would be fine for me. But remember: most sites use forms, people are used to them.

Collapse
Posted by pipo de clown on
bluh!
blah!
bleh!
Collapse
Posted by Matthew Howard on
There was an interesting summary of user behavior in response
to pop-ups on the CHI-WEB list last fall:

http://www.acm.org/archives/wa.cgi?A2=ind0110d&L=chi-web&;
F=&S=&P=476

In terms of usability the problem is not javascript but the habits
of users, who may be conditioned to ignore or close popups
without reading them.