Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

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

Level 10

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