Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Problem setting maximum characters for a date field.


Level 4

Good morning all. I am trying to ensure that a date field on the form I am working on validates if the entry is not more than 8 digits, and if it is more, it should display a message, and return the focus back to the field until it is correct. Below is the code I wrote but it is not working:



    xfa.host.messageBox(Enter eight digits for the date in the format YYYYMMDD or use the drop down calendar.);



I do not know why it is not working, i need help. I have this code on the exit event.




2 Replies


Level 7

Well you are missing the " around the text in your messagebox but even then it doesn't seem to work. I am not a javascript expert so am not sure why but it works in formcalc like this:

if(Len($) > 8) then

    xfa.host.messageBox("Enter eight digits for the date in the format YYYYMMDD or use the drop down calendar.")




Level 10

I won't do this, because you'll frustrate users if there is a message shown every time they enter a wrong format.

Better you allow as many pattern as possible.

Here's an explaination: