Jump to content

Adding a month to cassio date w/ javaScript


Recommended Posts

I've been trying to add a month to a date for the use of recurring payments. The code I have to put in the HTML block I have placed below. And thats a code i got from someone else on this website but it doesn't not work. 

 

Please help.

[@field:New_Date*]

<SCRIPT LANGUAGE="JavaScript">

function setDate()

{

     var New_Date = "first";

     var Current_Date_1 = "second";

 

     New_Date = "InsertRecord" + New_Date;

     Current_Date_1 = "InsertRecord" + Current_Date_1;

 

     var New_Date = document.getElementById(New_Date ).value;

     var New_Date = new Date(Date.parse(New_Date));

     var result_Date = new Date (first_Date.setMonth(first_Date.getMonth()+1));

 

     var d_month = result_Date.getMonth() + 1;

     if (d_month<10) {d_month = "0" + d_month;}

     var d_day = result_Date.getDate();

     if (d_day<10) {d_day = "0" + d_day;}

     var d_year = result_Date.getFullYear();

     var str_date = d_month + "/" + d_day + "/" + d_year;     

 

     document.getElementById(Current_Date_1[@field:Current_Date_1*] ).value = str_date;

}

document.getElementById("caspioform").onsubmit=setDate;   

</SCRIPT>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...