In my app I’ve got multiple tabs. In tabs I’ve got input fields and I want to validate these fields in client side. For this I try to use HTML5 attributes, for example required attribute or pattern attribute. In case when I’ve got empty field (field is required) in first tab which is selected, the error message appears The field is required, but when I’ve got empty field in other tab for example in third tab and my first tab is selected, the error message does not appears.
Question
Is there way to organize validation with HTML5 in this situation ?
Are you hiding form elements with
display: none? If your elements are not visible they will not trigger the validation UI:In this situation you will have to listen to the
invalidevent with your own script and perform a suitable action.