These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Correct Date format

patra
Registered: Oct 19 2006
Posts: 270

There is any way so all users use the calander than type the date into Date-Time Field?
We'll like to avoid incorrect date format.
Prefered format March 9, 2010

Thanks

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
That would be a really cool feature. But no, the only way to get the date picker popup is for the field to have focus, which means allowing the user to enter data. However, something you can do is validate the entry and if it is incorrect display a popup message telling the user to use the date picker tool.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

patra
Registered: Oct 19 2006
Posts: 270
Thom, thanks for your reply.
At list is it possible when the user types into date field and the date it's not the correct format
(date{MMMM D, YYYY}) the field to remain empty and with a pop up message to force them to use the calander?

Thanks
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Yes it is possible. Just enter a Validation script that results in a false value if the format is incorrect.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

patra
Registered: Oct 19 2006
Posts: 270
Thom, thanks for your help but I am not a programer to write the code!
If you give us a help we really appreciate!

Thanks Thom
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Try setting the Display pattern and the Validation pattern to: MMMM D, YYYY This is an easy way to get you most of the way there without any scripting. Be sure to set a validation error message.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

SDDWA
Registered: Apr 16 2010
Posts: 12
thomp wrote:
Yes it is possible. Just enter a Validation script that results in a false value if the format is incorrect.
I'd like to see such a validation script! The built-in validation displays the error if the date doesn't meet the data pattern format, but leaves the incorrect data in the field and lets you move on to the next field...
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Here's an easy test. Add a validation script to any fields with just this JavaScript code:
false;
See what happens,

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

SDDWA
Registered: Apr 16 2010
Posts: 12
thomp wrote:
Here's an easy test. Add a validation script to any fields with just this JavaScript code:
false;
See what happens,
Thom,

I understand how the validate event script area works, but what is the correct syntax of the "tests" to check if the entered date matches the selected validation patterns? Does LC set an accessable flag somewhere if the current data doesn't match the pattern? How do I reference a date pattern in an if/then statement?
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
If you write a validation script you have to do the validation yourself. Usually this is done with a regular expression, but for dates you could use the date parsing function in Acrobat JavaScript

util.scand();

Look it up in the Acrobat JavaScript refernce. There's also a tutorial on using this fucntion at this site.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

SDDWA
Registered: Apr 16 2010
Posts: 12
So... from what I can tell then, the validation pattern error message is just "for show". Someone correct me if I'm wrong about these points:

It doesn't do anything other than show the message in the box when the data entered doesn't match the pattern(s) set in the edit data pattern.

It doesn't stop the user from going onto the next field, or make them go back and enter the data in the correct format.

It doesn't set a value anywhere that can be checked to see if the data that was entered passed validation.

It's actually kinda worthless... in my opinion.

And, from what I can tell, using a regular expression function doesn't allow to you verify that it's a VALID date... if your format is MM/DD/YY you can enter 05/36/10 and it will still accept it.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The built-in pattern validation is simple. If you want somthing more, then a script can be written to just about anything. However, it's friendlier to warn the user while they are filling in the form, and then do a second level of validation at submision to block them from continuing until the form is filled out correctly.

As far a testing for correct dates, that's why I suggested using the util.scand fucntion. Dates are one data type that there are built-in functions for handling.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script