14 Replies Latest reply on Feb 23, 2017 4:04 PM by brianh74414767

    Autofull date that compensates for February --adjust current script or rewrite if needed. i have included the script below.

    brianh74414767

      Hello All,

      I have read a number of posts on several sites. Additionally have noted a number of knowledgeable folks supporting all the of the newb questions. I have visited some resource sites like adobe. and various forums like this one.
      However I am still not able to glean the solution for the correct java script that will address correctly auto populating the  Month of February if 1.29 thru 1.31 is selected in the initial date field.
      all other dating works correctly
      Form has 3 date fields, I am trying to provide script that will allow my users to populate the first field and the 2nd and 3rd field will be dated 1 month later , naturally Feb. is an exception
      the main script I have used to this point is
      // get value of field to update - field name is Text5
      var sDate = this.getField('Text5').value;
      // convert to date time object
      // the fields format is mm/dd/yyyy
      var oDate = util.scand('mm/dd/yyyy', sDate);
      // get the parts of the date
      var fFullYear = oDate.getFullYear(); // 4 digit year
      var fMonth = oDate.getMonth(); // zero based month
      var fDate = oDate.getDate(); // date of month
      // increment the month
      fMonth++;
      // create new date time object
      var oNewDate = new Date(fFullYear, fMonth, fDate);
      // set field value - field has no format
      // formatting is applied by the printd method

      event.value = util.printd('mm/dd/yyyy', oNewDate);
      I have tried a couple others that I could share if needed, however the result of those scripts is the same...I can share the other variations of java scripts used in further posts.

       

      Any assistance in creating the additional scripting needed would be Greatly appreciated.

      Ps I have tried tweaking this with formula for adding or subtracting days but alas not doing it correctly.

      Again Thank you in advance

      Brian

      [ Mod: Email address removed ]