Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

Auto-calculate End Date based on Start Date + Sub-department

Avatar

Level 2

I need assistance with setting up form fields so they behave the way we want.

On an HR form there are 3 fields:

  • Sub-department [ApplicantSubdepartment]
  • Start Date [ApplicantStartDate]
  • End Date [ApplicantEndDate]

A) For vast majority of the items selected from the ApplicantSubdepartment drop-down list, the following occurs:

i) Select an item from the ApplicantSubdepartment DDlist.

ii) Select a date in the ApplicantStartDate date field.

iii) System automatically sets a date in the ApplicantEndDate date field that is 5 years from the ApplicantStartDate value.

iv) User can manually alter the ApplicantEndDate date so it is LESS than the 5year maximum, but cannot be MORE than the 5year maximum.

B) For one specific item ("Auxiliary") selected in the ApplicantSubdepartment drop-down list, the following occurs:

i) Select "Auxiliary" from the ApplicantSubdepartment DDlist.

ii) Select a date in the ApplicantStartDate date field.

iii) System automatically sets a date in the ApplicantEndDate date field that is 3 years from the ApplicantStartDate value.

iv) User can manually alter the ApplicantEndDate date so it is LESS than the 3yr maximum, but cannot be MORE than the 3yr maximum.

1 Reply

Avatar

Former Community Member

I created a sample for you ..FormCalc has some nice Date functions so I used those instead. Have a look at the exit event of the date fields. I am also using a gloabal variable defined in the form properties to hold the max date.

Paul