• Post Reply Bookmark Topic Watch Topic
  • New Topic

Retaining selected value in combo box after refresh

 
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: 65530
108
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: 65530
108
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 ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!