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
https://forums.phpfreaks.com/topic/71381-creating-a-number-only-text-field/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.