Expand my Community achievements bar.

Code not working like I want

Avatar

Former Community Member
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 xfa.host.messageBox("It Works"); "

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



Can someone help clean up this mess?



Thanks,

Bernie



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



if ($.isNull ne 1) then

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

if (nDays <= 0) then

xfa.host.messageBox("Please enter the date in MM/DD/YYYY format.");

xfa.host.setFocus($.name);

endif

endif



----- 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");

// xfa.host.messageBox (DCV);

if (DCV<0) then

xfa.host.messageBox("End Date must be greater than Start Date");

xfa.host.setFocus($.name);

else xfa.host.messageBox("It Works");

endif

else $ = null

endif
0 Replies