I am coding a form, one of the input’s type is “number”, so it has the upside and downside arrow to increase or decrease the number, also for some reason it allows the user to enter number in the text as well, so number is entered in the text box, it will be saved and submitted to database, but if i use the arrow to change the number, updated number will not be saved and submitted to server, why is that?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
input type “number” is one of several new types of input supported under HTML5. This type is not supported by older browsers including IE 8 and older. From your description it sounds like the value is changing when you click or enter the number which is the expected functionality.
Why the value isn’t making it through when you submit the form is not entirely clear. For example a form like this:
<form method="POST" action="/somescript.php">
Quantity (between 1 and 5):
<input type="number" name="quantity" min="1" max="5">
<input type="submit" value="Submit">
</form>
This form should work to allow you to change the number and the result will be sent as a POST variable to “/somescript.php”. If you are using javascript to validate the form on submission or to gather form fields before submission this is where I would look for a problem.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.