2 Replies Latest reply on May 22, 2008 3:29 PM by (Steve_Evans)

    Validating a form field resets field; wipes out user input

      I have a form field with a javascript that validates if the user inputs a value, it must be 17 characters long:

      if (event.value && event.value.length != 17){
      app.alert("Name must be 17 characters long)");



      The above script works but if the field fails validation the field contents is reset to what it was before the user entered a value. This means if the field was blank and the user enters a value which then fails validation the alert gets displayed but then the FIELD IS RESET TO BLANK (alternatively, if the field had a valid value and the user changed it to an invalid value, after the validation the fleld is changed back to the original value.

      How can I stop it from resetting the field to the previous value (usually blank) if the validation fails. want the incorrect value to remain as i so the user can see what they did wrong and correct it.

      It's not a great user experience if what they entered gets wiped out on them.