Jump to content

Date+1 and Insert on Submission Form


Recommended Posts

Hi, I have a simply one that I just can not figure out. I know it's easy but I haven't been able to get this to work.

I have a field where the user will enter a date. I want to take that date and add one, then insert into another field on a submission form.

 

Field Name: End Date (user entered) = 10/23/2017

Field Name: Expire Date (calculated) = 10/24/2017

 

Any help would be appreciated.

Link to comment
Share on other sites

12 hours ago, lmooring said:

Hi, I have a simply one that I just can not figure out. I know it's easy but I haven't been able to get this to work.

I have a field where the user will enter a date. I want to take that date and add one, then insert into another field on a submission form.

 

Field Name: End Date (user entered) = 10/23/2017

Field Name: Expire Date (calculated) = 10/24/2017

 

Any help would be appreciated.

You can use formula field with dateadd function:

DATEADD(dd, 1, [@field:end_date])

If you prefer JavaScript, have a look at this post, you just need to add 1 day instead of 1 month.

 

Link to comment
Share on other sites

Hi thank you for the response. Unfortunately formula fields are not visible on the submission form (to my knowledge). I need the date+1 to appear on the submission form prior to submission. If the date needs to be changed due to the result of the +1 date calculation, the user can do so prior to submitting the form.

Link to comment
Share on other sites

Hi Imooring,

You can try to use the following code on your Submission Form in order to insert "+1 day" value into your Expire Date field upon user select the date in End Date field:

<script>
function DateAdd()
 {

var a = new Date(document.getElementById('InsertRecordYOUR_FIELD_End_Date').value);

a.setDate(a.getDate() + 1);

var dd = a.getDate();
var mm = a.getMonth()+1;
var yy= a.getFullYear();

var b = mm + '/' + dd + '/'+yy; // you should change an order if you use non-US localization in your Submission Form

document.getElementById('InsertRecordYOUR_FIELD_Expiration_Date').value=b;

}

document.getElementById('InsertRecord_YOUR_FIELD_End_Date').onchange= DateAdd;

</script>

You should place this code into the Footer of your Submission Form. Please make sure that you have disabled HTML editor.

Hope this helps.

 

Link to comment
Share on other sites

  • 1 year later...

Hi @lmooring,

As of July 12, 2018, Caspio introduced new features which you can find here: https://howto.caspio.com/release-notes/caspio-bridge-13-0/

This release includes a new feature, Calculated Values in Submission Forms.  This allows you to generate calculations which you can use for your date using Mathilda's DATEADD(dd, 1, [@field:end_date]) and then submit/insert it to your table without using JS.

Check these videos for more information:

 

 

 

I hope it helps!

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...