Hi, I would like to know how to check the current value and the previous value entered by user before changes. for example, the form will allow user to enter customer number. The first time user enter 10 then change to 22 customer number : 10 -> change to 22 how do I get the previous value which is 10 in this case
There are loads of ways to achieve this, let me know why you are wanting to do this and I can point you in the right direction. Also do you use a database to store the customer number and how is the form processed (php/asp)?
You could always use a hidden form field to keep the old value: <form name="valueform"> <input type="hidden" name="oldvalue" value=""> <input type="text" name="myvalue" value="" onblur="saveOldValue(this.form);"> </form> Code (markup): Anytime the user changes the myvalue textbox above and moves from the field, the saveOldValue function below will display an alert with the old value. <script language="Javascript" type="text/javascript"> function saveOldValue(inFrm) { if ( inFrm.oldvalue.value != '' ) alert('Old Value: '+inFrm.oldvalue.value); inFrm.oldvalue.value = inFrm.myvalue.value; } </script> Code (Javascript): Granted, all of this is client-side, and probably doesn't help you if you wish to display a value a user has submitted to a server-side script. You can always pre-fill the oldvalue textbox with a value from the server though. Hope this helps a little.
...and you should bind the old value with the element you are watching (such as text edit box). like: text_el.old_value = value so that you could easy pick up it in the future