roattw Posted April 22, 2017 Report Share Posted April 22, 2017 I have a table field AGE set as an integer. I need the form to disallow alpha characters in that field when exiting that field. Cant get ti to work. I still have submissions allowing "approx. 50" and I need to limit them to discrete numbers only. I added this script in footer, which helps, but its only on submit. Isnt the fact that the field type is INTEGER mean it wont accept letters by default? <script>function isNumberKey(evt){ var charCode = (evt.which) ? evt.which : event.keyCode if (charCode > 31 && (charCode < 48 || charCode > 57)) return false; return true;}document.getElementById('@field:Age').onkeypress =isNumberKey;</script> Quote Link to comment Share on other sites More sharing options...
Mathilda Posted April 24, 2017 Report Share Posted April 24, 2017 On 4/22/2017 at 9:53 PM, roattw said: I have a table field AGE set as an integer. I need the form to disallow alpha characters in that field when exiting that field. Cant get ti to work. I still have submissions allowing "approx. 50" and I need to limit them to discrete numbers only. I added this script in footer, which helps, but its only on submit. Isnt the fact that the field type is INTEGER mean it wont accept letters by default? <script>function isNumberKey(evt){ var charCode = (evt.which) ? evt.which : event.keyCode if (charCode > 31 && (charCode < 48 || charCode > 57)) return false; return true;}document.getElementById('@field:Age').onkeypress =isNumberKey;</script> You need to use this script in the html block. Add html block, place it below all the fields, hit Source tab and insert your script. Also I would recommend using complete syntax InsertRecordAge instead of '@field:Age'. Integer datatype doesn't allow entering characters only on the table level in datasheet view. Hope that helps. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.