lmooring Posted October 23, 2017 Report Share Posted October 23, 2017 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. Quote Link to comment Share on other sites More sharing options...
Mathilda Posted October 24, 2017 Report Share Posted October 24, 2017 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. Quote Link to comment Share on other sites More sharing options...
lmooring Posted October 24, 2017 Author Report Share Posted October 24, 2017 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. Quote Link to comment Share on other sites More sharing options...
Vitalikssssss Posted October 25, 2017 Report Share Posted October 25, 2017 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. lmooring 1 Quote Link to comment Share on other sites More sharing options...
lmooring Posted October 25, 2017 Author Report Share Posted October 25, 2017 That worked perfectly, Thank You! Quote Link to comment Share on other sites More sharing options...
Kurumi Posted June 20, 2019 Report Share Posted June 20, 2019 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! Quote Link to comment Share on other sites More sharing options...
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.