If a form has some optional fields what is best way to handle validation for it?

Simplest solution is to not validate the optional fields and simply allow form submission but sometimes we need to validate the optional fields too. So we, validate optional fields when they get focus and its all good.

But how should we proceed if user interact with field so it get validated and shows error, should we allow form submission even if there is a error message or we should disable submit button so user need to fill the correct info or clear the field?

In short,

  • Optional field > not changed > no validation > allow submit.
  • Optional field > changed > trigger validation > valid > allow submit.
  • Optional field > changed > trigger validation > invalid > ???
  • If the field is set, then it's not 'optional' anymore, so you should validate it and stop submission if there are errors. I'm I missing something?
    – Fernando
    Commented Aug 3, 2017 at 15:46
  • thanks, yeah I am going with validation and disabling submit button. I think I will mark @UXfrom12 as accepted.
    – vicodin
    Commented Aug 3, 2017 at 15:49

1 Answer 1


Optional field > changed > trigger > invalid > allow submission

The field is invalid, as long as you visually show that the field has failed validation, you shouldn't stop them submitting the form.

That said...

This depends on the field, if you need it to perform actions in the background or for other purposes then there may be a value in halting the submission on change if it doesn't validate and re-enabling submission is they clear the field.

Update Given your comment below, it'd be good to use a control that prevents the user entering the date of birth in the wrong format in the first place.

So validation is not required.

  • the field in question is Date of Birth field. This field is not going to be used for any calculations, like age or something.
    – vicodin
    Commented Aug 3, 2017 at 10:56
  • Then go with submission, try to think of future scenarios where you may want to use date of birth. Will update answer. Commented Aug 3, 2017 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.