Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can we get previous value that user select in options?

 
Nakata kokuyo
Ranch Hand
Posts: 472
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi good day, if i have an option , how to i keep the the previous state/value that user have selected before change to new state/value ,

i have try using hidden to keep it , but is there any better way to do so ?

thank you for guidance
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64828
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does this previous value need to be submitted as part of the form? If so, then a hidden element is just fine. If not, you could just store it in a Javascript variable.
 
Nakata kokuyo
Ranch Hand
Posts: 472
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Bear Bibeault , if using javascript variable , and i use document.form.optionname.value , it always take the value of after onchange, how to get the previous value before user change on option ?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64828
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Store it before the user makes the change. Once it's changed, there's no way to find the previous value.
 
Nakata kokuyo
Ranch Hand
Posts: 472
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you , bear
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic