I would recommend that you perform validation before changing tabs. If the form is valid, you allow to change the tab, otherwise, you stay in the same tab until the form is validated.

You can do...