![]() Using brilliant HTML5 data attributes we can tell Quaid to predict state select fields. However, be careful of relying on the data source and allow users to make corrections beyond the basics.Īustralian postcodes give a fairly accurate prediction of the associated state. Since there's no input type for postcodes, Quaid JS picks up the appropriate class (postcode) to add validation.Įnhance this by validating against a database with a custom Ajax call. Postcodes fit set patterns, which makes validating them quite simple. Vary the text to explain why the field is optional and, more to the point, why a user may need to fill it in: Mobile Phone (if you have one) Given that the majority of form fields are required (if not, why are you including them?), it's much more user-friendly to mark optional fields. Quaid simply looks for a class to do the trick.įor some time, the convention for marking required fields has been to add an asterisk somewhere near the field or label. While HTML5 introduces the tel input type, it doesn't provide any way to discriminate between different types of phone numbers when necessary (for example, mobile and fixed line). This field is highlighted and displays the associated error message on hover and focus If you're doing your own email validation, be careful of an overly simple regex - email addresses are more complex than they initially appear: Email The email field uses the HTML5 type email that triggers Quaid JS's email validation. ![]() This is a standard HTML5 input marked with the required attribute: Name If the field data is going to a database, set the maxlength to the same as the corresponding database field. Set an appropriate field size, giving an indication to users of how much you want them to enter. Remember to include the for attribute when adding a label without it you can't tap/click a label to focus on the associated field – crucial with hard to click/tap radio buttons and checkboxes. Add a block element (p, li, th or td) to contain each label and field. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |