Hi,
I Have a field with validation, if input is incorrect I do get an error message, but the form will still accept the incorrect input.
How can I force the user to correct the input before leaving the field?
Here are the validation conditions:
this.rawValue>=1.35 && this.rawValue<=1.47;
I am a VERY new user with no programming experience, so please keep it in layman's terms.
Thanks for your help,
Bryan
Views
Replies
Total Likes
Place the below code in the Validate event..
if(this.rawValue>=1.35 && this.rawValue<=1.47){
this.tst = true;
this.tst || Boolean(this.execEvent("exit"));
}
else
this.tst = false;
And then place the below code in the Exit event..
if
(this.rawValue != null && this.rawValue != ""){
if(!(this.tst)){
//if Validate event does not get executed, this.tst value is coming as undefined, then force to execute the validate event
if(this.tst == undefined)
this.execEvent("validate");
else
xfa.host.setFocus(this.somExpression);
}
}
Thanks
Srini
Views
Replies
Total Likes
Thank you Srini for the help.
It does work, however, if you click on the adjoining cell a number of times it will eventually accept the incorrect data.
Shouldn't it refuse to take the data altogether, or did I not copy and paste the data correctly?
Thanks,
Bryan
Views
Replies
Total Likes
Try this code in the Validate event.
var blnValidationFailed = false;
if(this.rawValue>=1.35 && this.rawValue<=1.47){
blnValidationFailed = true;
}
if(blnValidationFailed == false)
this.tst = false;
else
this.tst = true;
this.tst || Boolean(this.execEvent("exit"));
Thanks
Srini
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies