homepage Welcome to WebmasterWorld Guest from 54.167.179.48
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Remembering <select> box value
Gian04

5+ Year Member



 
Msg#: 3982544 posted 9:57 am on Sep 2, 2009 (gmt 0)

I have 2 <Select> boxes

The 1st one is populated upon page load (PHP)
The 2nd one is populated via javascript (no page reload) depending on the 1st select box value.

Upon submit the page will display a preview of the user inputs, with 2 submit buttons [send] and [edit]

My problem is if the user choose to edit, how can I make it that 2nd select box remember its value since after a page reload the 2nd select box doesnt have any contents (options),

Adding options to the 2nd select box is triggered by the 1st select box hence the following code is not possible.

<option value="value_here>" selected>Text Here</option>

note : The 2 select boxes pulled values from a DB table.

 

daveVk

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 3982544 posted 12:37 pm on Sep 2, 2009 (gmt 0)

Try including an input type=hidden with no value on initial load, save result of second selection there, hopefully it will still be there on page reload.

Arno_Adams

5+ Year Member



 
Msg#: 3982544 posted 2:23 pm on Sep 2, 2009 (gmt 0)

Stuff the values in the querystring?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved