6 Replies Latest reply on Nov 25, 2015 12:59 AM by try67

    Military Time Format

    Smokey2007

      So I have this custom format script (shout out to try67) that allows me to type in military time without colons:

       

      if (event.value=="" || /^\d{4}$/.test(event.value)) {

          var hours = +event.value.substring(0,2);

          var minutes = +event.value.substring(2,4);

          if (hours>23 || minutes>59)

              event.rc = false;

          else event.rc = true;

      } else event.rc = false;

       

      if (event.rc == false) {

          app.alert("Invalid time format.")

      }

       

      It works GREAT but I ran into a problem.... Military time runs from "0000 to 2359." (Midnight to 11:59PM) If I type "0000" into the field and try to click the submit button, my form validation message shows that field as blank and required. How do I fix that?