Skip to content
This repository has been archived by the owner on Feb 10, 2019. It is now read-only.

Not validating a field? #26

Closed
tmikaeld opened this issue Dec 7, 2011 · 6 comments
Closed

Not validating a field? #26

tmikaeld opened this issue Dec 7, 2011 · 6 comments

Comments

@tmikaeld
Copy link

tmikaeld commented Dec 7, 2011

Hi again :-)

I'm trying to make h5 not validate specific fields in a form.

Yet using :not() or .not() does not work. Is there any other way i can make h5 ignore specific fields?

@ericelliott
Copy link
Owner

The best way right now is:

  1. Don't use the required attribute
  2. Don't use the pattern attribute

Right now h5Validate ignores the novalidate and formnovalidate attributes because it uses them to override native browser behaviors. This is likely to change before 1.0 release, if we can figure out how to cleanly override or fall back on native browser behaviors, AND keep to the validation UI best practices we've discovered in real production e-commerce applications.

@tmikaeld
Copy link
Author

I'm not using the required or pattern attribute on these fields.

The problem i have is that they are being marked as "valid" and getting the valid class, i'd like to avoid that.

@ericelliott
Copy link
Owner

Cool. This is going on my todo list. I need to figure out the best way to do this. As far as I know, the only way to override browser validation behaviors is to set novalidate and formnovalidate, so I can't use those AND override the native browser validation behaviors (which right now are quite primitive in terms of UI behavior).

Maybe we can add a .novalidate class or something? This requires a little thought.

@tmikaeld
Copy link
Author

Adding a .novalidate class would probably be the simplest and most compatible way to do this, doing it in JS can be done by just adding the class to the element we don't need, and it can of course also be in the markup. I'm voting for class +1 for now :-)

Of course, it makes more sense to not validate a field that has no reason to be validated, but as you say, that require more thought.

@tmikaeld
Copy link
Author

It could also be a setting, though it's probably a bit more messy.

@ericelliott
Copy link
Owner

Yeah, I think I will do the class.

ericelliott pushed a commit that referenced this issue Dec 28, 2011
  object with element attribute.
* New feature: allValid events "formValidated" event. Sends
  validity objects with element attributes.

* Fixed issue #26 Add support for .novalidate
* Fixed bug #29 - Validate tries to validate disabled fields
* Fixed bug - Validate tries to validate buttons
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants