form type ="number" updated value cannot be submitted to server?

November 2, 2016 201 views
Applications FAQ Ubuntu

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?

1 Answer

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">

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.

Have another answer? Share your knowledge.