Keeping a option,select drop down list open on refresh / postback

C

crazychrisy54

Hi there

I have a option, select drop down list which a user can open. My page
however refreshes very frequently and when this occurs the selected
drop down list will pop back up. The user then has to open the drop
down list again.

I just wondered if there was a way using javascript to firstly detect
if the user has selected the drop down list and if so, on refresh to
set that drop down list to stay dropped down?

I hope that makes sense, if it doesn't please let me know!
Thanks for your help
Chris
 
L

Laser Lips

Cris, how is the page refreshing?

If the user is refreshing it by presing the refresh button, or the
page is refreshing itself using meta tags, then there is no way to
pass any state information to the page and you can not do it.
HOWEVER, if the page is using JavaScript to refresh, then you can load
the page instead of refreshing it and send it the value of the
currently selected dropdown, and reset the dropdown to that state when
the page reloads.

How is your page setup, is it just one frame?

Graham
 
C

crazychrisy54

Cris, how is the page refreshing?

If the user is refreshing it by presing the refresh button, or the
page is refreshing itself using meta tags, then there is no way to
pass any state information to the page and you can not do it.
HOWEVER, if the page is using JavaScript to refresh, then you can load
the page instead of refreshing it and send it the value of the
currently selected dropdown, and reset the dropdown to that state when
the page reloads.

How is your page setup, is it just one frame?

Graham

Hi Graham,

The page uses just one frame and the page refreshes automatically
using a meta tag. I was thinking there might be a way using java
script which detects when a user has clicked the dropped down list and
if so set a cookie saying the user has currently selected that drop
down list. Then when the page is refreshed, you could see if that
cookie is set and if so onload set the drop down list to be displayed?
I don't know if I am thinking along the right lines though.

Thanks
Chris
 
T

Thomas 'PointedEars' Lahn

The page uses just one frame and the page refreshes automatically
using a meta tag.

That alone is very bad for several reasons.

First, never ever use frames just to keep the Location Bar content the same;
users will be annoyed when they cannot easily bookmark the resource that
they are viewing, and users of UAs that are not capable to display frames
as they are (like lynx, frequently used as client for screen readers) will
consider you incompetent for inserting an unnecessary navigation step.
Annoyed users do not return, and chances are that they will tell all their
relatives, colleagues, and acquaintances how annoyed they were then and why.

Second, why are you refreshing *everything* when refreshing a portion of the
document (not: page) would suffice?

Third, you are using a proprietary and therefore inherently unreliable
feature here. <meta http-equiv="refresh" ...> is _not_ specified by HTML
4.01 nor even mentioned in the Specification. Nevertheless, there are UAs
that do support it and allow the support for it to be *disabled*, for
example Opera. So there is another problem.
I was thinking there might be a way using java script

Java != _JavaScript_
which detects when a user has clicked the dropped down list and
if so set a cookie saying the user has currently selected that drop
down list. Then when the page is refreshed, you could see if that
cookie is set and if so onload set the drop down list to be displayed?
I don't know if I am thinking along the right lines though.

Setting a cookie is a possibility; modifying the fragment identifier
part of the URI is better[1] because less intrusive and more reliable.
The best way is probably XHR[2], with a reload(true)'ed iframe, a
window.location.reload(true) call (all feature-tested at runtime before
use of course), and your `meta' element as fallbacks; in that order.

[1] Example: http://validator.w3.org/#validate_by_upload as compared to
http://validator.w3.org/
[2] http://developer.mozilla.org/en/docs/AJAX

But then I think you are this clueless that it is probably better for
you to read the FAQ first, and the scripting tutorials it refers to:

http://jibbering.com/faq/


HTH

PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top