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

How to restrict user from entering past date?

hemant.reality
Registered: Jun 22 2010
Posts: 5
Answered

Hi,

I need to restrict user from entering date values lesser than current date.
I am using calender Date/Time field and user is selecting date from the
calender. Then selected date is populated in 'DD/MM/YYYY' format into
field. Can any one suggest a way to allow the dates those are >= current
date.

Hemant

My Product Information:
LiveCycle Designer, Windows
MarlaZ
Registered: Apr 28 2010
Posts: 112
I'm with you. I also need that information.

Too bad there is not one place to find this simple and seemingly important functional information.

I don't know how many forums I have to go to chasing around after answers. Remember when User Guides/Manuals and Help files told you HOW to do things rather than just telling you WHAT you could do. So aggravating and unproductive!!

Marla

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
You need to write a validation script that returns the logical value of the comparison of the entered date as the number of days from the Epoch date ( use the Date2Num() function) and the number of days since the Epoch date for to day (use the Date() function).

More information is in LiveCycle Designer's 'Scripting Reference'.

George Kaiser

hemant.reality
Registered: Jun 22 2010
Posts: 5
Thanks George,

Your post helped me.

Marla here is code for you.

var sDate = IsoDate2Num(topmostSubform.Page1.Date1.rawValue)
var cDate = Date()
var diff = 0
diff = sDate - cDate
if (diff < 0) then
xfa.host.messageBox("Please Selct Date not less than Current Date", "", 3)
xfa.host.setFocus(topmostSubform.Page1.Date1)
endif

I am using IsoDate2Num as I am using Datepicker.
You can use Date2Num in case of normal date.

Regards,
Hemant.
MarlaZ
Registered: Apr 28 2010
Posts: 112
Hemant, thanks!

I will try it today!!

Marla