This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Retaining selected value in combo box after refresh  RSS feed

 
Pol Appan
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

How can I retain selected value in combo box after page getting refreshed?

Any help is highly appreciated.

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65828
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean with the refresh button?
 
Pol Appan
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when i click the submit button, page gets refreshed.
 
Jherald Lacambra
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can put the selectedIndex value on a hidden

when you submit do this:


on your myJsp.jsp


javascript:
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65828
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why bother with the hidden when the value itself is being submitted?
 
Raghavendra nandavar
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using struts, then the selected value can be
set in java action class, after the request is forwarded.

If not, you can use hidden field to store the
value before submit, and after submit, call a
function on load of the page and set the value back.

Hope this helps
[ March 14, 2006: Message edited by: Raghavendra nandavar ]
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!