Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

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