• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

pre-selecting values in a select list

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I have 2 pages , say page1.jsp and page2.jsp , i am getting some values from user as input in page1 and after pressing the submit button in page1.jsp, it goes to page2.jsp . In page2.jsp, i am getting these values input by user using a request.getParameter(). page2.jsp has many select lists. Depending on the values the user input in the page1, the select list has to be set to that initial values. For example, there is a select list named "letter type" with values type1 , type2, type3 . If the user selected type2 in the page1, then in page2 the "letter type" select list has to be pre-selected to type2 automatically. Also, I am initialising the "letter type" select list from a javascript file that is included in the page, i mean i dynamically generate the select list.
Can anyone tell me how to pre-select values in the select list. I know if we set the selected property of the option to "selected" it would work, but how to do this based on the user input??
Please let me know how to do this.
Thanks
Priyha
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You would have to get the value of the form passed to the next page via query string of some other method. The you when the javascript is dynamically making the dropdown, then you have to make the selected property true when the values match the information that was passed.
What do exactly want?
Eric
 
Priyha Jootu
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Eric, I did this using the URL search string. This link helped me to do this easily: http://ashutoshsaxena.tripod.com/jstut/tutorials/realjs11.html
Priyha
 
I'm doing laundry! Look how clean this tiny ad is:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic