11 Replies Latest reply on May 6, 2015 4:57 PM by MarcusMacmillan

    Javascript input box validation error

    MarcusMacmillan

      I'm using the below script in the Actions Tab to validate text is being entered into the input box. otherwise it generates the message and refocuses on the field.

       

      event.rc = true;

      var str1 = event.value;

      if (str1.length ==""){

      app.alert("A GIVEN NAME MUST BE ENTERED IN THIS FIELD");

      event.target.setFocus()

      }

      endif

      event.rc = false;

       

      This part of the code seems to work fine, however as soon as I add similar code to the next input box it goes into a indefinite loop between the two app.alert boxes without giving the chance to enter any valid data

       

      event.rc = true;

      var str2 = event.value;

      if (str2.length ==""){

      app.alert("A FAMILY NAME MUST BE ENTERED IN THIS FIELD");

      event.target.setFocus()

      }

      endif

      event.rc = false;

       

       

      Any help / ideas would be greatly appreciated as I am getting nowhere fast.

       

      Thanks