I need to calculate the difference between today’s date and the date selected in the form, and if the difference is less than 18 years – I need to automatically change the dropdown value in another field.
The ‘Student info’ section has ‘Date of birth’ field. I want to calculate the date selected in this field and compare it to today’s date on the fly, and if the difference is less than 18 years – I need the ‘Legal’ dropdown to change the value to ‘Yes’.
Why I’m doing this? The ‘Legal’ field triggers the ‘Guardians’ block below the contact info when it’s set to ‘Yes’. I did this using conditional logic. Now I want to hide the ‘Legal’ field via CSS and have the date calculation change the value from ‘No’ to ‘Yes’ if student’s age is under 18.