Populate a 2nd date field min date from a previous date field in webform before submission

32 Views Asked by At

I have 2 date fields on a webform. The 1st date field has a min date set

first_date:
  '#type': date
  '#title': 'First Date'
  '#date_date_min': 'today + 3 days'
  '#datepicker': true
  '#date_date_format': 'l, F j, Y'

The 2nd date field needs to be populated with a minimum date, reflecting the date entered into the 1st date field so that the user cannot select a date before the date entered into the 1st date field.

second_date:
  '#type': date
  '#title': 'Second Date'
  '#datepicker': true
  '#date_date_format': 'l, F j, Y'

As in the image below, the user can select a date for the 2nd date field before the date entered into the 1st date field.

This needs to happen on the form entry before the form is submitted.

Is this possible within the scope of the Webform module or does it require some javascript?

enter image description here

I have read that this is possable using the function drupal_process_states

I'm not a coder. Just asking for help / direction. Thanks

0

There are 0 best solutions below