Jump to content
  • 0

Shouldn't NUMBER field only allow numbers?


roattw

Question

2 answers to this question

Recommended Posts

  • 0
On 4/27/2017 at 10:54 AM, roattw said:

Trying to get a number field (Age) to only allow numeric entries.  Possible?  In a basic HTML5 form it would just be <input type="number">.  Am I missing something?

In a perfect world, a pop up message when alpha characters entered would also e nice.

Hi,

As far as I know you can't define "number" form element on a datapage, I suppose that your field is set to text form element even if your datatype is number in a table. However, you will not be able to submit characters, an error message should appear once you hit "Submit"

I use script from this  post on my datapage. This script allows entering numbers only in a field.

Another option - you can create an html form and submit data to caspio: http://howto.caspio.com/tech-tips-and-articles/advanced-customizations/how-to-convert-existing-html-forms-to-work-with-caspio/

Link to comment
Share on other sites

  • 0

Mylene.  This is working with one exception.  

Works great but wont work on two other text fields setup the same way. The only thing different is that the two fields where it doesn't work are fields that Show/Hide based on a Rule. Wondering if that Rule status is preventing the field name to be recognized by the script?


<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('InsertDTN_time').onkeypress =isNumberKey;
</script>

Link to comment
Share on other sites

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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...