Jump to content

Expiration Field Update


Recommended Posts

<script>
function f_date(){

var expireDate=document.getElementById('EditRecordDATEFIELDNAME').value;
var v_assignDate = (expireDate.getMonth() + 1) + "/" + expireDate.getDate() + "/" + (expireDate.getFullYear()+1);
document.getElementById('EditRecordDATEFIELDNAME').value = v_assignDate;

}
f_date();
</script>

try the code above in the Footer of your update page. "EditRecordDATEFIELDNAME" needs to be replaced with ID of date field.

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

I have tried the script above and change the f_date(); to the suggest script above. I still am having no luck in it changing the date. The field is called Expiration and it has the current expiration date in the field and I am trying to change that date on submit with a single record update datapage. I have tried this with the Expiration date hidden and display only. Neither works. What am I overlooking?

Link to comment
Share on other sites

This is the script being used. The Expiration Field is set as text and has the current expiration date in it 7/31/2018. I need to have it change to 7/31/2019

 

<script>
function f_date(){

var expireDate=document.getElementById('EditRecordExpiration').value;
var v_assignDate = (expireDate.getMonth() + 1) + "/" + expireDate.getDate() + "/" + (expireDate.getFullYear()+1);
document.getElementById('EditRecordExpiration').value = v_assignDate;

}
document.getElementById('caspioform').onsubmit = f_date;
</script>

Link to comment
Share on other sites

It is because " expireDate " is not defined as a date value. Try the following code:

 

 <script>
function f_date(){

var date=document.getElementById('EditRecordExpiration').value;

var expireDate = new Date(Date.parse(date));
var v_assignDate = (expireDate.getMonth() + 1) + "/" + expireDate.getDate() + "/" + (expireDate.getFullYear()+1);
document.getElementById('EditRecordExpiration').value = v_assignDate;

}
document.getElementById('caspioform').onsubmit = f_date;
</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...