In this guide, we will explain how to Increase the new repeat Date field value by one day.
The date field will show the next day’s date if we add a new repeat entry.
Drag and drop a Text and a Date field inside a Repeat group field, and a JavaScript field. Rename the Text and Date fields as shown below.
Click the pencil icon of the JavaScript field and paste the code.
Please use this code:
// Date Field Id In New Repeat View
var date_field_id = '6995-f436-6209';
// Listening to the element:create:success event , so as to increment the date field by one day once new repeat entry is created
window.formyoula.form_fields[ '2dd3-80ee-3085' ].on( 'element:create:success', function( event ) {
// Create Tommorow's date
var tomorrow = moment().add( 1, 'days' ).format( 'YYYY-MM-DD' );
// Update the date field's value and trigger the change
window.formyoula.form_fields[ date_field_id ].set( { value: tomorrow } ).trigger( 'change' );
} );
Change the field IDs according to your form.
Try the form. When we add a new repeat entry the date field will show the next day’s date.
For any questions, please contact us - [email protected] or the Formyoula in-app chat 🙂