• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to preselect a value in drop down ?

 
Rite Sara
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ..

I am using Struts 1.3 and using following code to display drop down in one tab on my page ..



There is one more such drop down on home page.
If user selects an option on home page and navigates to this tab then the same value should be preselected in this drop down ..

Please let me know how this can be handled ..


Thanks,
 
Bhagat Singh Rawat
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
write a JavaScript method and call it onload. get options and iterate through them. Set option.selected=true whichever you want.
 
Ankit Garg
Sheriff
Posts: 9521
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can also use the value attribute of html:select tag to preselect any option...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic