Jump to content

Creating a Number-only text field


Xurion

Recommended Posts

I used the search but couldn't find anything to do with exactly what I need.

 

I have three text fields on a form. These three fields are:

 

1. Sub Total Price (Enabled)

2. 4% Surplus of Sub Total (Disabled)

3. Total (Disabled)

 

This form needs to allow the user to edit the sub total price, and with some simple JS I have made the other fields adjust accordingly. Now there is no validation in JS to prevent a user inputting an alpha character like 'aaa' and the returned values from the simple JS that I mentioned before are simply 'NaN' as you would expect.

 

What I am looking for is a way to make an input textfield numerical only; the field should only accept the input of numerical characters.

 

Thanks in advance.

 

Xur~

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.