Master Posted December 14, 2016 Report Share Posted December 14, 2016 How can I only allow number entry in a text 255 field on my page? Quote Link to comment Share on other sites More sharing options...
MayMusic Posted December 14, 2016 Report Share Posted December 14, 2016 Add HTML block at the end of your element list or in the footer of your page, click on Source and use the code below <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('InsertRecordPhone').onkeypress =isNumberKey; </script> Replace InsertRecordPhone with actual field ID that you want to only allow numbers Quote Link to comment Share on other sites More sharing options...
roattw Posted May 3, 2017 Report Share Posted May 3, 2017 Thanks Mylene. I was able to get this to work. But I think the onkeypress handler only works on web. Does not restrict letters on smartphones,. Any idea how to apply to mobile? Quote Link to comment Share on other sites More sharing options...
Armopankaj Posted February 25, 2021 Report Share Posted February 25, 2021 what format we need to use to specify the field is it [@field:FIELDNAME] or just Fieldname Quote Link to comment Share on other sites More sharing options...
CoopperBackpack Posted March 1, 2021 Report Share Posted March 1, 2021 Hello @Armopankaj, You may refer to this post https://forums.caspio.com/topic/4377-js-guide-caspio-form-elements/ If you have a Submission form and let`s say the field name is Number, then please use document.getElementById('InsertRecordNumber'). Hope this helps. Feel free to update this thread if you need any help with the script. 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.