This is an example of an HTML5 form with required and validate attributes that also uses visibleIf to dynamically hide and show form fields according to other form field values (in this case, the form will show a Postal Code field if the country chosen is Canada, or a zip code field if the country chosen is the United States. Note that the validation only happens on those fields that are visible, since the visibleIf library sets them to be disabled, which prevents validation. Back to User Agent Man HTML5 Forms article

Personal Information

Thank you for giving to the Zoltan Hawryluk Entertainment Fund. Your contribution will ensure that Webmasters in Need will be able to buy beer when they would otherwise do without.

Form fields labelled * are mandatory

Full Name:
Required. If you would like to give anonymously, tough. We find people are more generous when their Good Name is on the line.
Company Name:
If you are unemployed, please leave blank.
Postal Code:
Please enter a valid Canadian Postal Code. Valid format is H0H 0H0 where H is a letter and 0 is a number.
Zip Code
Please enter a valid American Postal Code. Valid format is nnnnn or nnnnn-nnnn where n is a numeric digit.