I am attempting to insert a new date based on a timestamp field in my datapage. I have an active_date field and a deactive_field. When a user updates a record, I would like 30 days added to the date in the active_date field and store the results in the deactive_field. I had the following code developed, but it doesn't work properly. Any suggestions? FYI, the code is placed in the footer of the datapage.
function getDiff()
{
var v_sDate = document.getElementByName("EditRecordActivation_Date").value;
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.
Question
coppage
I am attempting to insert a new date based on a timestamp field in my datapage. I have an active_date field and a deactive_field. When a user updates a record, I would like 30 days added to the date in the active_date field and store the results in the deactive_field. I had the following code developed, but it doesn't work properly. Any suggestions? FYI, the code is placed in the footer of the datapage.
function getDiff()
{
var v_sDate = document.getElementByName("EditRecordActivation_Date").value;
var sDate = new Date(v_sDate);
// converting the date in milliseconds
var milliSeconds = sDate.UTC();
// adding 30 days to the date
milliSeconds = milliSeconds + 2592000000;
// converting milliseconds back to date format
var dDate = new Date ( milliSeconds );
// converting date to string
finalDate = dDate.toDateString();
// storing the value in Deactivation_Date field
document.getElementById("EdittRecordDeactivation_Date").value=finalDate;
}
/* On submitting the webform, the function getDiff is executed */
document.getElementById("caspioform").onsubmit=getDiff;
Link to comment
Share on other sites
5 answers to this question
Recommended Posts
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.