Validating the form

Posted by / 22-Dec-2017 23:01

Validating the form

To make sure our user enters the right data in the email, website, and number of tickets fields, we can use some of the new input types added in HTML5: By specifying the appropriate type, our browser will validate the data for us and make sure we've got an email address in the email field, a URL in the website field, and a number in the number of tickets field.Note too that the If the user enters anything less than 1 or greater than 4, they'll be prompted to enter a number in the permitted range.

This keeps our HTML semantic, with the labels helping to give meaning to the input controls.

One option is to not do anything and rely on your server-side validation only.

This would require no extra work on your part, but would the UX for those using unsupported browsers be satisfactory?

As such, current best practice recommends supplementing the required attribute with the aria-required=”true” attribute: Now that our users get prompted to complete required fields, we need to make sure that the data they submit is in the format we require.

We'll want the 'Name' field to be submitted in the format 'Firstname Lastname', and to only contain letters and a space (NB in real world scenarios, you might need to take account of other locales – this example has been kept simple deliberately).

validating the form-57validating the form-36validating the form-81

One thought on “validating the form”

  1. All the more so because it was Malcolm who asked Martina out in the first place after they bumped into each other on a visit back to the hometown where they had once been school friends.‘Then he went a bit further, using a phone app called Take Me I’m Yours, designed to get couples together.