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

Code not working like I want


Not applicable
I have two date fields, "StartDate1" and "EndDate1".

When I make the EndDate1 value less than StartDate1, the "button" remains VISIBLE, but INACTIVE, and I can move on to the next field.

Why does the button remain visible, why is the button inactive, and how do I force the user to enter an EndDate1 value greater than that of StartDate1?

Also, in the Validate code, if I remove the line

" else"It Works"); "

then I get a syntax error, which I don't understand.

Can someone help clean up this mess?



----- F.P1.EndDate1::exit - (FormCalc, client) --------------------

if ($.isNull ne 1) then

var nDays = Date2Num($.formattedValue, "MM/DD/YYYY");

if (nDays <= 0) then"Please enter the date in MM/DD/YYYY format.");$.name);



----- F.P1.EndDate1::validate - (FormCalc, client) ---------------

var DCV

if (HasValue(StartDate1) and HasValue(EndDate1)) then

DCV = Date2Num(EndDate1, "YYYY-MM-DD") - Date2Num(StartDate1, "YYYY-MM-DD");

// (DCV);

if (DCV<0) then"End Date must be greater than Start Date");$.name);

else"It Works");


else $ = null

0 Replies