Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Retaining selected value in combo box after refresh  RSS feed

 
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
 
Author and ninkuma
Marshal
Posts: 66678
167
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.
 
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: 66678
167
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?
 
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 ]
 
The problems of the world fade way as you eat a piece of pie. This tiny ad has never known problems:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!