DropDown Box problem - Any Solutions

G

gary

In our site we are encountering problems with drop down boxes. We have
a dropdown box & the ONChange event of which is fetching some data from
a servlet. However when we use history back button , the data of
previous page is displayed correctly but the dropdown selected index
always lags behind by one.
For instance if the selected index of dropdown is 1 data relating to it
is diplayed on table, if second option is selected a call to servlet
returns data relating to the second selection in the table et-al.
However if we click back it correctly shows the cached data of previous
dropdown value but the item in the drop down box is still pointing to
the latest one.
Would appreciate solution sharing .
Thanks
Here's the scenario Test Code in ASP:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<%
seldata = Request.Form("bankId")
Select Case ucase(seldata)
case "BANK1"
Input1 = "BANK1 Selected"
selectedOption1 = "selected"
case "BANK2"
Input2 = "BANK2 Selected"
selectedOption2 = "selected"
case "BANK3"
Input3 = "BANK3 Selected"
selectedOption3 = "selected"
case "BANK4"
Input4 = "BANK4 Selected"
selectedOption4 = "selected"
End Select
%>
</head>
<body onload="">
<form action="test.asp" name="testform" method="post">
Test 1 : select Bank :
<select name="bankId" size="1" OnChange="testform.submit() ;">
<option id="bank1" <%=selectedOption1 %> >Bank1</option>
<option id="bank2" <%=selectedOption2 %> >Bank2</option>
<option id="bank3" <%=selectedOption3 %> >Bank3</option>
<option id="bank4" <%=selectedOption4 %> >Bank4</option>
</select>
<table>
<tr><td> Show1</td> <td ><%= Input1 %> </td></tr>
<tr><td> Show2</td> <td ><%= Input2 %></td></tr>
<tr><td> Show3</td> <td ><%= Input3 %></td></tr>
<tr><td> Show4</td> <td ><%= Input4 %></td></tr>
</table>
<br>
Test 2 : submiting to client : <input type="submit" >
</form>
</body>
</html>

Is there
any way on the client side we can make drop down boxes behave correctly

with history back button. Would appreciate if you have any solution
 
R

RobG

gary said:
In our site we are encountering problems with drop down boxes. We have
a dropdown box & the ONChange event of which is fetching some data from
a servlet. However when we use history back button , the data of
previous page is displayed correctly but the dropdown selected index
always lags behind by one.
For instance if the selected index of dropdown is 1 data relating to it
is diplayed on table, if second option is selected a call to servlet
returns data relating to the second selection in the table et-al.
However if we click back it correctly shows the cached data of previous
dropdown value but the item in the drop down box is still pointing to
the latest one.

I think it's a matter of perception. The selected option changes first,
then the new page is loaded. When you use 'back', the 'new' option is
selected because it's the one that was selected when the navigation
moved on.

You might be able to use an onload function that uses the URL search
attribute to recover the option that should be selected and set it
accordingly. Alternatively, store the option index that should be
selected somewhere (say in the class attribute of your table) and use that.

Onload seems to fire when the 'back' button is used for the samll set of
browsers I tested, but from memory some browsers, or versions of
browsers, do not.

Here's the scenario Test Code in ASP:

Not much point in posting server code here unless it's specifically
requested. Post what the client sees (view source is pretty handy for
that).


[...]
 

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
474,263
Messages
2,571,064
Members
48,769
Latest member
Clifft

Latest Threads

Top