Hello
I put CONTRACT START DATE and CONTRACT END DATE fields on the form. These 2 objects (Date/Time objjects) i pulled them from Satndard tab of pallette and dropped on my layout page design, fine.
Now, am trying to put a validation that the end dat eshould not lower than start date, so, i got a thread as below from Niall,
http://forums.adobe.com/message/1909551
and i did my FormCalc coding under EXIT event of END DATE field as below,
// Pls. note this FormCalc
// End date should not less than Start date, else CLEAR it - Begin
var stDate
var endDate
stDate = xfa.resolveNode("CUSTOMER.Page31_Contracts.Con_Whole_Page.CON_Basic_Info.CON_START_DATE").rawValue
endDate = xfa.resolveNode("CUSTOMER.Page31_Contracts.Con_Whole_Page.CON_Basic_Info.CON_END_DATE").rawValue
if (stDate > endDate) then
xfa.host.messageBox("End date is lower than Start date! End date is cleared")
xfa.resolveNode("CUSTOMER.Page31_Contracts.Con_Whole_Page.CON_Basic_Info.CON_END_DATE").rawValue = null
endif
// End date should not less than Start date, else CLEAR it - End
I tried in VALIDATE, CALCULATE, CHANGE events of END DATE, but nothing working!!
PLs. let me kow how can i achieve my requirement? I am anewbie,
Thank you
Solved! Go to Solution.
Views
Replies
Total Likes
If you use the exit event, you will probably have to have the same code on both the start and end date fields since they have a dependancy on each other. Maybe better to try the validate event of the end date so that if either field is changed the event gets fired. You can try the following for validate event
// Pls. note this FormCalc
// End date should not less than Start date, else CLEAR it - Begin
var stDate
var endDate
stDate = CON_START_DATE.rawValue
endDate = $.rawValue
if ( HasValue(endDate) ) then
if (stDate > endDate) then
xfa.host.messageBox("End date is lower than Start date! End date is cleared")
$.rawValue = null
endif
endif
1
// End date should not less than Start date, else CLEAR it - End
Views
Replies
Total Likes
If you use the exit event, you will probably have to have the same code on both the start and end date fields since they have a dependancy on each other. Maybe better to try the validate event of the end date so that if either field is changed the event gets fired. You can try the following for validate event
// Pls. note this FormCalc
// End date should not less than Start date, else CLEAR it - Begin
var stDate
var endDate
stDate = CON_START_DATE.rawValue
endDate = $.rawValue
if ( HasValue(endDate) ) then
if (stDate > endDate) then
xfa.host.messageBox("End date is lower than Start date! End date is cleared")
$.rawValue = null
endif
endif
1
// End date should not less than Start date, else CLEAR it - End
Views
Replies
Total Likes
See this thread about how to do this: http://forums.adobe.com/message/4235514#4235514
Thank you, perfect.
By chance if you hv time, pls. let me know for the other relevent validation, as below,
The start date should not be lower than current date/todays date/today? I have opened a new thread for it, the link is as below
http://forums.adobe.com/thread/974950
Thank you
Views
Replies
Total Likes
Hello
I have implemented your (dohanlon's) solution, it worked fine for 2 days, all of suddden i am getting the below error message as soon as the form is launching on the browser (prior to displaying any layout objects, the time glass is runing/blue round symbol going on..., i am getting the error message), its as below
"CON_END_DATE validation failed!"
I tried the form by saving on my local laptop and tried to reopen, same this is happening!
Pls. let me know do i need to put any PATTERN or some more Script or i need to change the event from VALIDATION to some other?
Thank you
Views
Replies
Total Likes
Are you sure you still have the 1 at the end of the script block? That tells the validation engine not to fail and display a default message. Also check the patterns are the same for both date fields
Views
Replies
Total Likes
Hello,
Ohhhhhhhhhhhhhhhhhhhhhhh........ yup, i thought "1" is typed by mistake by
me!!! henec deleted
Hmmmmmm..... JavaScript/FormCalc (I work on 4th generation language, hence
we dont hv these kind of stuff)
Thank you
Views
Replies
Total Likes
Also, i wan to let you know that i did not put any kind of PATTERNS on the field/object. I have selected DEFAULT LOCAL, bcz my form is global, i mean, its for US and Europe
Pls. let me know do i need to put any PATTERNS (edit, validate) to support your solution/code?
Thank you
Views
Replies
Total Likes
Should be fine without setting a pattern for this
Thank you.
Views
Replies
Total Likes
Views
Likes
Replies