Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Aug 2005
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how to check the current value and the previous value

    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

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,015
    Thanks
    203
    Thanked 2,538 Times in 2,516 Posts
    var firstAttempt = 0; // or 999999999999 if you prefer
    var secondAttempt = 0;
    var customerNumber; // the number input by the customer
    if (customerNumber != firstAttempt) {
    secondAttempt = firstAttempt;
    firstAttempt=customerNumber;
    }

    secondAttempt contains the previous (different) number entered.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •