aspose file tools
The moose likes HTML, CSS and JavaScript and the fly likes can we get previous value that user select in options? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "can we get previous value that user select in options?" Watch "can we get previous value that user select in options?" New topic
Author

can we get previous value that user select in options?

Nakata kokuyo
Ranch Hand

Joined: Apr 13, 2005
Posts: 446
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

Joined: Jan 10, 2002
Posts: 61979
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Nakata kokuyo
Ranch Hand

Joined: Apr 13, 2005
Posts: 446
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

Joined: Jan 10, 2002
Posts: 61979
    
  67

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

Joined: Apr 13, 2005
Posts: 446
thank you , bear
 
Consider Paul's rocket mass heater.
 
subject: can we get previous value that user select in options?