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.
Fo 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
 
S

Steve Easton

For starters you shouldn't use OnChange, because people who navigate via the
keyboard instead of a mouse will never be able to select anything but the
first item in the dropdown.

Try it. Use the tab and arrow keys and see what happens.

You "should" use OnSelect

Which by the way might solve the problem.

Also, make sure you have the page open with the top item in the dropdown
"Selected"
and that the top item doesn't do anything.

--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer
 
H

hkpant

Thanks for the quick response Steve.
I tried ur suggestion with this test page.
However There's 1 glitch , OnSelect event doesn't work at all. Here's
the asp test code ;
<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>
 
S

Steve Easton

Sorry, I "assumed" javascript.
Let me do some digging, or you could repost it as an asp question.


--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer
 
S

Stefan B Rusynko

Your problem is the browser history does not rerun thru the ASP engine
Try forcing it to not cache the page (always get fresh data from ASP engine

<%
Response.AddHeader "Cache-Control", "No-cache"
Response.AddHeader "Pragma", "No-cache"
Response.CacheControl = "No-cache"
Response.Expires = -1
Response.ExpiresAbsolute=#Dec 1, 2005 12:00:00#
%>
--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


| 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.
| Fo 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
|
 
G

gary

Thanks Stefan for your suggestion.
However it doesn't really solve the purpose. As I had mentioned earlier
this was just a test page to check whether Steves solution of using
Onselect event works & incidently javascript didn't support this event
in our case where the Onchange event was submitting a form.
In our application scenario , we have lots of such Html pages with
dropdown boxes having Onchange event , which submit the form and the
request is posted to servlets which retrieve data and pass it on to
instances of xmlc precompiled static pages to send the response.Since
its a heavily data driven site we don't want to prevent caching at the
application level so No-chache option is a strict no-no in this
case[Also ours is java not ASP based app].We want caching .. 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 .
 
G

gary

Thanks Stefan for your suggestion.
However it doesn't really solve the purpose. As I had mentioned earlier
this was just a test page to check whether Steves solution of using
Onselect event works & incidently javascript didn't support this event
in our case where the Onchange event was submitting a form.
In our application scenario , we have lots of such Html pages with
dropdown boxes having Onchange event , which submit the form and the
request is posted to servlets which retrieve data and pass it on to
instances of xmlc precompiled static pages to send the response.Since
its a heavily data driven site we don't want to prevent caching at the
application level so No-chache option is a strict no-no in this
case[Also ours is java not ASP based app].We want caching .. Is there
any way on the client side we can make drop down boxes behave correctly
with history back button in javascript? Would appreciate if you have
any solution .
 

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

Top