


Hi
I have a date field which should be lesser than current date. I have used validation code in the validate event which returns either true or false and based on that error message gets displayed, which is all working fine.
Now if the validation fails, I want to reset the field which is not happenning in my case.
Pls. help.
Thanks
Abhiram
Views
Replies
Sign in to like this content
Total Likes
Hi,
You could include a line as part of the validation script:
this.rawValue = null;
So that if validation fails, the message will display and then the field will be cleared.
Hope that works,
Niall
Views
Replies
Sign in to like this content
Total Likes
By doing so, the field is getting cleared but the message is not displaying.
Suppose lets take a case of email validation.
I have used the following code in the validate event
var
r = new RegExp();
r.compile("^[a-z0-9_\\-\\.]+\\@[a-z0-9_\\-\\.]+\\.[a-z]{2,3}$"
,"i");
var
result = r.test(this.rawValue);
if
(result == true)
{
true;
}
else
{
false;
}
In this code if i use this.rawValue=null after or before "false" ,error message is not getting displayed.
Thanks
Abhiram
PS: Validation part is working absolutely fine.
Views
Replies
Sign in to like this content
Total Likes
Hi,
I think the issue is that the value of the selection is not complete when you are validating, try the exit event. Also try resetting the date:
xfa.host.resetData("xfa.form.form1.page1.DateTimeField");
Hope that helps,
Niall
Views
Replies
Sign in to like this content
Total Likes