2 Replies Latest reply on Nov 11, 2013 12:49 PM by dlsmith36

    Date Fields calendar scroll linked


      I am a noob at scripting and I have a issue maybe someone can assist me with. 


      I am creating a form in LCD that has three date fields: campaign start date, campaign end date and billing date.  Here is what I need to happen.  When the campaign start date is entered through the monthly calendar scroll and selected, the campaign end date scroll should begin where the campaign start date left off. Additionally, the billing start calendar scroll should start the following month on the 1st after the campaign start date.  This will eliminate the need to continually scroll through some of the months on the form.  The fields need to remain editable just incase the default results are not the intended dates.


      This coding can be in either language (javascript or formcalc). Here is a sample of the form I am creating


        • 1. Re: Date Fields calendar scroll linked
          jasotastic81 Level 3

          Well, would you object to just setting the end date to the same day as the beginning date? That will cause the calendar in the end date to open to the same month as the start date.


          In the "exit" event for the start date add this code.


          if (dfEndDate.isNull) dfEndDate.rawValue = this.rawValue;


          This will cause the date to populate automatically for the end date.



          For the second question, you can add code to do this. It's kinda lengthy, so be prepared. Also, it doesn't make the date look pretty until you select it on the calendar scroll. Add this to the enter event of bill date.


          if (this.isNull) {

               if (dfEndDate.rawValue.slice(5,7)!="12") {

                    var nextMonth = Number(dfEndDate.rawValue.slice(5,7))+1;

                    var fulldate = dfEndDate.rawValue.slice(0,5) + nextMonth + dfEndDate.rawValue.slice(7);

                    this.rawValue = fulldate;


               else {

                    var nextMonth = "-01";

                    var nextYear = Number(dfEndDate.rawValue.slice(0,4))+1;

                    var fullDate = nextYear + nextMonth + dfEndDate.rawValue.slice(7); 

                     this.rawValue = fullDate;




          Message was edited by: jasotastic81 --Whoops! told you to put that in the wrong place.

          • 2. Re: Date Fields calendar scroll linked
            dlsmith36 Level 1

            Thank you for your suggestion. I used the first coding only, my boss changed her mind on the contract options.