Proposal to add 'required' attribute to input tag

Hi,
 
It mostly doesn't make sense to submit a form without filling some input fields. However, this is possible, so I suggest to add a 'required' attribute to input tag. If the tag has no value form can't be submitted and the tag is focused when submit button is clicked.
 
Example (registration):
 
<form ...>
  <p>Username:</p>
  <input type="text" required>     <!-- you can't register an account without an username -->
 
  <p>Password:</p>
  <input type="password" required="6">     <!-- you can't register an account without a password and it should be at least 6 characters long -->
 
  <p>Password again:</p>
  <input type="password" required="6">


  <p>Phone number:</p>
  <input type="number">     <!-- you dont have to provide your phone number to register -->
</form>
 
Thanks,
Jozef

Received on Monday, 9 June 2014 20:22:46 UTC