Consider this quite common signup form, don’t worry about styling here.
<input name="name"> // required
<input name="phone"> // required and valid number
<input name="email"> // required and valid email
Write a validation event handler that is run on form submit. Validation rules should be derived from inputs’ attributes. With that being said, feel free to add additional attributes as needed.