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

Date validation code

bdryburgh
Registered: Oct 12 2006
Posts: 15
Answered

I have created a form in LiveCycle Designer ES 8.2 with a date picker field in it. I would like to add some kind of date validation check in this field - where if the user picks a date that is 7 days or less from today's date, a message box will be generated telling the user to pick a later date.

I am thinking this might be something fairly simple to accomplish in FormCalc, but I'm not good enough at it to figure that out, and my programmer coworker isn't familiar enough with FormCalc or Javascript to help me out. Any ideas as to how I would begin with this process?

My Product Information:
LiveCycle Designer, Windows
pddesigner
Registered: Jul 9 2006
Posts: 858
I've developed a pdf that may be the solution and requires more work in one of the fields to validate it and display a message if the date is not correct. Below is the URL to the solution. It will expire in 10 days.

http://www.epubservice.com/PDF/bdryburgh.pdf

Hope this helps.

My favorite quote - "Success is the ability to go from one failure to another with no loss of enthusiasm.

bdryburgh
Registered: Oct 12 2006
Posts: 15
Thanks. While that wasn't quite what we were looking for, it was similar in a roundabout way. That version chose the number of days and then gave a final date. We wanted something that when the user picked a move date that was less than 7 days from today's date, it would generate message basically telling them to pick another date.

But it must have got my programmer's juices flowing, because we finally came up with this FormCalc option:

var current = Date()
var move = Date2Num(MoveDate.formattedValue)
var numdays = move - current
if (numdays < 7) then
xfa.host.messageBox("You may not choose a date that is less than 7 days from today's date. Please choose another date.")
MoveDate.rawValue=""
endif

Which we put in the exit event of that field (the click event of our submit button was already in use).
richl
Registered: Dec 4 2009
Posts: 2
I am using LiveCycle Designer ES 8.2 with a date picker field in it and I want to make it so that the user can only choose a date in the drop-down menu and not put any other text into it. Thanks.
pddesigner
Registered: Jul 9 2006
Posts: 858
To richl,

Take a look at this pdf file. It may have the answer.

http://www.box.net/shared/static/mi125zc1nj.pdf

My favorite quote - "Success is the ability to go from one failure to another with no loss of enthusiasm.