I have a form I am working on. But I can't figure out how to make the field have a pop-up message if someone enters .40 instead of 40. I want the field to block anyone from putting in .40 and only allow them to enter numbers straight up (i.e. 40).
If the user enters anything BUT straight up numbers, I want the pop-up message to say "Input the mileage rate as the number of cents per mile (i.e., 30 instead of .30)."
Thank you in advance for any help!
The form is attached........
Solved! Go to Solution.
Views
Replies
Total Likes
You can add this script to the exit event of the field. If they enter a value of < 1 then a message will appear and the code will multiply the value by 100 to make it cents and not dollars.
if (this.rawValue < 1) {
app.alert("Enter your milage rate in cents 40 and not dollars .40");
this.rawValue = this.rawValue * 100;
}
If you woudl rather you can put the cursor back into the field and allow the user to remedy the entry before moving on. To do this use the command:
xfa.host.setFocus(this);
Hope that helps
Paul
Views
Replies
Total Likes
You can add this script to the exit event of the field. If they enter a value of < 1 then a message will appear and the code will multiply the value by 100 to make it cents and not dollars.
if (this.rawValue < 1) {
app.alert("Enter your milage rate in cents 40 and not dollars .40");
this.rawValue = this.rawValue * 100;
}
If you woudl rather you can put the cursor back into the field and allow the user to remedy the entry before moving on. To do this use the command:
xfa.host.setFocus(this);
Hope that helps
Paul
Views
Replies
Total Likes
This worked! Now if I want to add the xfa.host.setFocus(this);, where in the code do I put it?
Views
Replies
Total Likes
If you are putting that in I assume that you want the user to correct the error. So simply replace the line:
this.rawValue = this.rawValue * 100;
with the setFocus line.
Paul
Views
Replies
Total Likes
Great! Thanks a bunch!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies