Expand my Community achievements bar.

Form Guides: trying to do a date comparison

Avatar

Former Community Member
Hi,



I'm trying to do a simple data comparison using Javascript within a form guide. Here is what I came up with:



if (this.rawValue > util.printd("yyyy-mm-dd", new Date())) {

xfa.host.messageBox ("date cannot be in the future");

}



this works great on the PDF form, on the form guide it returns an error about "util" being undefined.



Is there a way to do this without having to manually parse date strings?



Regards,



Steve
2 Replies

Avatar

Former Community Member
The util.printd is not supported in guides. Remember that this is based on XFA forms and Action script running inside of a Flex application. I would suggest that you will have to use parsing to get what you want as there is no Date mapping between the two.

Avatar

Former Community Member
This seemed to work:



if (new Date(this.rawValue + " 00:00:00") > new Date()) {



xfa.host.messageBox("Date cannot be in the future.");

}



It only seems to work on the form guide, and I had to set the display Date property on the PDF form for the date field to be:



date{MM/DD/YYYY}



Regards,



Steve