6 Replies Latest reply on Aug 13, 2015 9:27 AM by Sean.twyman

    having trouble with - if one field empty then another field should be empty

    Sean.twyman Level 1

      Im having trouble with this code. What i am doing is taking a user entered time and adding 10 minutes to it and displaying the new value in a second field. However if the user entered field is empty then the second field should also be empty.  Here is the code i am using and it is located in the custom calculation field of the second field ( have also tried it in the validation part of the second field.)

       

      var strStart = this.getField("Break2O").value;
      strStart = strStart + " 1/1/70";
      
      
      if(strStart.length)
      {
      var timeStart = util.scand("h:MM tt m/d/yy", strStart);
      var oNext = timeStart
      oNext.setMinutes(oNext.getMinutes()+ 10);
      var oneHour = 60 * 60 * 1000;
      var sNext = util.printd("h:MM tt", oNext);
      event.value = sNext;
      }
      else {
      //if (strStart = "");{
      event.value = "0";
      }
        //event.value = this.getField("Break2O").value;
      

       

      any help is greatly appreciated. I have some more custom calculation stuff to do with the same project (Time Card Calculation) if anyone can help me out.