Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

0 views
Skip to first unread message

crazyc...@hotmail.com

unread,
May 9, 2008, 6:20:38 AM5/9/08
to
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

Laser Lips

unread,
May 9, 2008, 8:23:21 AM5/9/08
to
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

crazyc...@hotmail.com

unread,
May 9, 2008, 8:33:06 AM5/9/08
to

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

Thomas 'PointedEars' Lahn

unread,
May 9, 2008, 12:19:45 PM5/9/08
to
crazyc...@hotmail.com wrote:
> 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
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee

0 new messages