Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Date field question

Avatar

Level 2

I was wondering if it is possible to have one or multiple date fields change colors or become highlighted based off input from another date field.

What i have is a form that has an oldest possible date field and i want my other date fields on the form to become highlighted if an older date then the oldest possible date field is selected.

Thanks

1 Reply

Avatar

Level 10

Hi,

this isn't complicated to realize:

Just add a small FormCalc script into the possible oldest date field exit event.

In this example the font color of the Datefield2 will change to red if the selected date is before August the 1st 2014.


var dateFormat = "MM/DD/YYYY"


if (Date2Num($.formattedValue,  dateFormat) lt Date2Num("08/01/2014",  dateFormat) ) then


  DateField2.font.fill.color.value = "255,0,0"


  DateField2.caption.font.fill.color.value = "0,0,0"


else


  DateField2.font.fill.color.value = "0,0,0"


  DateField2.caption.font.fill.color.value = "0,0,0"


endif