This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
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 this week in the OCAJP 8 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: 463
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: 63351
    
  70

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: 463
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: 63351
    
  70

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: 463
thank you , bear
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can we get previous value that user select in options?
 
It's not a secret anymore!