Menu icon Foundation
How to exclude certain input fields from Abide verification?

I have a form with data-abide. How can I exclude certain input fields from being validated? Specifically, I needed a field for an "old password" that should have no constraints on the input. If I specify input type="password" pattern=".*", the pattern is completely ignore by Abide, it always used the predefined password pattern.

So can I specify either a pattern or tell abide somehow to not check my input field?

abide

I have a form with data-abide. How can I exclude certain input fields from being validated? Specifically, I needed a field for an "old password" that should have no constraints on the input. If I specify input type="password" pattern=".*", the pattern is completely ignore by Abide, it always used the predefined password pattern.

So can I specify either a pattern or tell abide somehow to not check my input field?

This post has been closed. No new replies can be added.

Sacha Corazzi over 5 years ago

Hi Marc,

I was having this problem too.

Unfortunately, I haven't come up with a way of excluding certain elements with an abide form, but I did sort the password issue.

Open up your foundation.min.js (if you're using that) or your foundation.abide.js, then find this part:

 password : /(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,

The dotall regex pattern isn't in JavaScript. Instead, you'd be wanting to use

/[\s\S]/

which basically matches any whitespace or non-whitespace character.

I'm testing it now, and it works perfectly. Good luck!