Abide "required" default behavior

Here follows a rather basic question about Abide data validation. I’m new on the forum and hope I’m not asking a question that has been beaten to death already. I didn’t find it in the search.

Suppose I set a field to be validated with:
<input type="text" pattern="number" placeholder="Spouse Name" required>
and this field gets shown or hidden on the form depending on user actions.

Is it correct that Abide’s default behavior is to ignore the “required” attribute on this field when it is not visible, so it will not block form submission when it is hidden? Or does one have to do something special to prevent Abide from blocking form submission when a field is marked “required” and it is both empty and invisible?

(Thanks!)

See the valid solutions at https://get.foundation/sites/docs/abide.html#ignored-inputs

Daniel –

Thanks for replying to my question. I’m seeing in the examples that you linked (“ignored inputs”) that any input with type=“hidden” will be ignored. What about other cases? Suppose the input is not so marked, but is marked as style=“display: none;” or is in a div that is marked as style=“display: none”, etc. (style=“visibility: hidden;”).

Is there any magic here, that allows Abide to ignore all inputs that are not shown on the form, or do I need to supply some logic in javascript or jquery that ensures that type=“hidden” is set?

Then it will be (probably) not ignored. I see no .is(':visible') in our code which would cover this case.

Probably, yes.

1 Like

Thank you. That clarifies it for me. Armed with this, I can make my form behave correctly.