By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,135 Members | 1,135 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,135 IT Pros & Developers. It's quick & easy.

Persisting Values

P: n/a
I have a form that has a dropdown list that will cause a post to the same
page when it's changed. The problem I'm running into is that all of the
controls reset to their default values (obviously expected behavior).
What's the recommended/best way to persist these values through the post
process? I know I could set them to the request.form values of themselves,
so to speak...but I didn't know if there was a simpler/more efficient way.

Thanks,
James
Jul 19 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
The only solution that I found was to write the VALUE using
value=<%response.write request("userName")%>. For the list boxes, I
chopped of the HTML into two segments such as...

<%if request("airline") <> "" then%>
<option value="<%response.write request("airline")%>"<%response.write
request("airline")</option>
<%else if%>
<option value="">---Select Airline---</option>
<%end if%>
[rest of the option's here]

This puts the selected option at the top of the list.

I STRONGLY recommend avoiding the specifying which options is SELECTED.
I had mutliple problems with this when I was testing across different
browsers with and without the a particular option selected. Writing the
value from the request as the first option achieves the same effect as
if it were written using SELECTED.

David H
James Baker wrote:
I have a form that has a dropdown list that will cause a post to the same
page when it's changed. The problem I'm running into is that all of the
controls reset to their default values (obviously expected behavior).
What's the recommended/best way to persist these values through the post
process? I know I could set them to the request.form values of themselves,
so to speak...but I didn't know if there was a simpler/more efficient way.

Thanks,
James


Jul 19 '05 #2

P: n/a
Thanks for the reply. Only issue I have with that 'selected' issue is, I
have a multi-select box. Am I SOL?

"David C. Holley" <Da**********@netscape.net> wrote in message
news:u1**************@TK2MSFTNGP11.phx.gbl...
The only solution that I found was to write the VALUE using
value=<%response.write request("userName")%>. For the list boxes, I
chopped of the HTML into two segments such as...

<%if request("airline") <> "" then%>
<option value="<%response.write request("airline")%>"<%response.write
request("airline")</option>
<%else if%>
<option value="">---Select Airline---</option>
<%end if%>
[rest of the option's here]

This puts the selected option at the top of the list.

I STRONGLY recommend avoiding the specifying which options is SELECTED.
I had mutliple problems with this when I was testing across different
browsers with and without the a particular option selected. Writing the
value from the request as the first option achieves the same effect as
if it were written using SELECTED.

David H
James Baker wrote:
I have a form that has a dropdown list that will cause a post to the same page when it's changed. The problem I'm running into is that all of the
controls reset to their default values (obviously expected behavior).
What's the recommended/best way to persist these values through the post
process? I know I could set them to the request.form values of themselves, so to speak...but I didn't know if there was a simpler/more efficient way.
Thanks,
James

Jul 19 '05 #3

P: n/a
<<
I have a form that has a dropdown list that will cause a post to the
same page when it's changed. The problem I'm running into is that all of
the controls reset to their default values (obviously expected
behavior).
What's the recommended/best way to persist these values through the post
process? I know I could set them to the request.form values of
themselves, so to speak...but I didn't know if there was a simpler/more
efficient way.


Perhaps this may hopefully give some ideas, it's got a downloadable
sample, and does retain values after the post back:

ASP Design Tips - Dependent Listboxes
http://www.bullschmidt.com/devtip-de...tlistboxes.asp

Best regards,
J. Paul Schmidt, Freelance ASP Web Designer
http://www.Bullschmidt.com
ASP Designer Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #4

P: n/a
Well if you're using a multiple-select box, the solution is simple -
DON'T! (It only hurts when I bend it like this...)

I'm clueless at that point, since I haven't encountered that problem
yet.

David H

www.gatewayorlando.com

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #5

P: n/a
Hmmmm....but you could try something where you kind of 'fool' your
visitor. When the page resubmits to itself, if there's an option in the
list box selected you could write a list box populated ONLY with
selected values - each with the SELECTED spec in the <option> tag. Then
provide the user when a CHANGE or CLEAR button that resubmits back to
the page, but with a querystring value that tells the page to draw the
list box with ALL possible values.

EVENT: Initial Page Load
ACTION: Populate list box with all possible values

EVENT: Self-submit - no value in the querystring or no values selected
ACTION: Populate list box with all possible values

EVENT: Self-submit - no value in the querystring, but values selected
ACTION: Populate list box with values from the request with each one
having the SELECT specified
Show the CHANGE/CLEAR button

EVENT: Self-submit - value in the querystring
ACTION: Populate list box with all possible values

I'm a bit frazzeled from work but at least that might get you going in
the right direction.

David H

James Baker wrote:
Thanks for the reply. Only issue I have with that 'selected' issue is, I
have a multi-select box. Am I SOL?

"David C. Holley" <Da**********@netscape.net> wrote in message
news:u1**************@TK2MSFTNGP11.phx.gbl...
The only solution that I found was to write the VALUE using
value=<%response.write request("userName")%>. For the list boxes, I
chopped of the HTML into two segments such as...

<%if request("airline") <> "" then%>
<option value="<%response.write request("airline")%>"<%response.write
request("airline")</option>
<%else if%>
<option value="">---Select Airline---</option>
<%end if%>
[rest of the option's here]

This puts the selected option at the top of the list.

I STRONGLY recommend avoiding the specifying which options is SELECTED.
I had mutliple problems with this when I was testing across different
browsers with and without the a particular option selected. Writing the
value from the request as the first option achieves the same effect as
if it were written using SELECTED.

David H
James Baker wrote:
I have a form that has a dropdown list that will cause a post to the
same
page when it's changed. The problem I'm running into is that all of the
controls reset to their default values (obviously expected behavior).
What's the recommended/best way to persist these values through the post
process? I know I could set them to the request.form values of
themselves,
so to speak...but I didn't know if there was a simpler/more efficient
way.
Thanks,
James



Jul 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.