1 Reply Latest reply on Dec 17, 2010 7:16 AM by chapmanga

    Handling form dates

    chapmanga Level 1

      Hi there,

      I have a straight forward form in that requires the user to enter a date in one box and then a script automatically fills in a second box with an new date 10 day further on.

       

      The script I'm using is

      var strStart = this.getField("DateStart1").value;
      if(strStart.length)
      {
        var dateStart = util.scand("d-mmm-yyyy",strStart);
        var oneDay = 24 * 60 * 60 * 1000;
        var dueMillis = dateStart.getTime() + 5 * oneDay;
        var dueDate = new Date(dueMillis);
        event.value = util.printd("d-mmm-yyyy",dueDate);
      }
      else
        event.value = "NA";
      

       

       

      the problem i have is that when the user fills in any of the other boxes on the form prior to the date (which given the flow of the layout is a sensible the natural thing to do) the get the following warning.

      Picture 1.png

       

       

      Now the two form fields involvedd in the script have their format to d-mmm-yyy, so any ideas (other than having the user always fill in the date box first) as to how I prevent this box from showing up.

       

      thanks in advance for any help.