This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan 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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 437
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: 60050
    
  65

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: 437
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: 60050
    
  65

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: 437
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?
 
Similar Threads
serialization
Using 3rd party API, display tag query regarding Pagination
Why do I need AJAX?
Multiple responses to one request
Embed form element value in scriplet?