2 Replies Latest reply on Jul 30, 2013 5:41 AM by James A Hiltz CET

    How to blank date field

    James A Hiltz CET Level 1

      I have the following statment which works just fine however,

      I would like to blank or clear the field if d1 is blank.

       

       

      // Get date from field

      var v = getField("Date").value;

       

       

      // Get the field values, as numbers

      var d1 = getField("Age_Days_1").value;

       

      if (v) {

       

          // Convert string to date

          var d = util.scand('mm/dd/yyyy', v);

       

          // add d1 as days

          d.setDate(d.getDate() + d1);

       

          // Set this field value to the new date

          event.value = util.printd("mm/dd/yyyy", d);

        

      } else {

       

          // Clear this field

          event.value = "";

      }