We have a decimal field in a LiveCycle Designer-designed PDF form that is intended to capture a latitude value. I want to make sure that the users enter exactly three decimal places. And I don't want the PDF to create the decimal digits for them. The user must enter them.
I tried to capture any improperly entered values using a this.rawValue.match(myRegEx) method as shown below in the field's exit event, but JavaScript threw the following error:
TypeError: this.rawValue.match is not a function
17:XFA:form1[0]:Page7[0]:Facility_Coord_Latitude[0]:exit
Here's the code I was using. This is confusing because I use this exact approach on a different field. Although that other field is a text field and this one is a decimal field. Maybe the "match" method doesn't work for decimal fields? Any way to convert the decimal value to a string to which I can use the "match" method? Or any other ideas for how to do this?
if (this.rawValue != null){ // only if the field has a value...
if (
!this.rawValue.match(myRegex1) &&
!this.rawValue.match(myRegex2)){ // it doesnt match any of the patterns
xfa.host.messageBox('Please enter your value to exactly three decimal places.');
xfa.host.setFocus(this.name);
}
}