Comments (7)
I understand that emails of the form a@b are perfectly valid in the spec
I know that the spec allows emails like that, but outside of internal email addresses at companies, that's not what real email addresses look like. You're correct in your guess that Bouncer uses a different pattern to detect valid emails. It specifically looks for a TLD.
You're certainly welcome to pass in a custom pattern for emails, though, if you want something less restrictive.
It's unclear what "submit button not disabled" in the title means relative to this issue, though. Can you clarify?
from bouncer.
"submit not disabled" just means the standard disabled button as you would style with form:invalid input[type="submit"]
In the code/screenshot as above 'disabled' is styled grey, 'active' is orange.
Thats the only extent of the bug, 'invalid' is somehow not being applied to the form (but you still cant submit... ie its just a visual bug)
from bouncer.
I did try to pass in some alternate patterns with the same result (there seems to be quite a range of different regexes)
Are you able to post a pattern that would be the equivalent of whats used internally?
from bouncer.
Ah yes, bouncer doesn't disable any of the buttons on error, though that's certainly something you could extend using the event hooks.
Adding a class to the form is not a bad idea, though. I like that. Will open a new ticket for that as well.
Here's the regex pattern used natively by browsers, per this website:
/^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/
from bouncer.
I realise now that this is just chrome behaving correctly - in html5 terms a form with email a@b IS valid, and so chrome correctly applies the 'active' css to the submit. (only that bouncer marks the field as invalid as per its rules)
As you mentioned, a js-applied class on the form could be used as a css hook for this state (but it would have to override the rules as described above if you want it all to work no-js)
Thanks for your time!
from bouncer.
I gave this a bit more thought, and decided not to add an error class on the form itself.
Bouncer validates individual fields on blur (as opposed to on submit with native form validation), and for fields with errors, it revalidates in real time as the user types.
In order to properly remove an error class from the entire form, Bouncer would need to constantly query the DOM to see if any other fields have errors.
It appears as though your issues are caused by hooking into native validity state for styles instead of (or on top of) using the class hooks Bouncer provides.
I would recommend using the [novalidate]
attribute as a style hook in your CSS to suppress those styles after Bouncer initializes. Alternatively, you could add a class to the form after the bouncerInitialized
event fires.
from bouncer.
I ended up passing the following pattern:
pattern="[a-zA-Z0-9!#$%&'+/=?^_`{|}~.-]+@[a-zA-Z0-9-]+(.[a-zA-Z0-9-]+)"
using the 1.4.1 version of Bouncer, this makes Bouncer allow emails of the form a@b so in synch with native html5 validation.
Lets see if the client complains! :)
from bouncer.
Related Issues (20)
- File validation problems HOT 1
- bouncerFormValid doesn't fire until re-submission of form HOT 2
- aria-required HOT 2
- getErrorLocation HOT 7
- Validating group of checkboxes (at least one required) HOT 1
- Reset validation HOT 1
- Error messages translations (Localization)
- Validation on form submit only HOT 1
- if I have two form in a page. How can I call bouncerFormValid two times for 2 form? HOT 1
- Documentation: form onsubmit preventDefault no effect without disableSubmit true
- Config of error message : Failure when defined via function + constraint is outOfRange or wrongLength HOT 2
- How can i validate two field is equal? HOT 2
- Age Validation
- Hidden/not visible fields are validated HOT 2
- Validating dynamically populated select
- Google Recaptcha stops bouncer HOT 4
- type="number" not correctly detected
- Validate Groups with CustomValidation?
- Does not support the multiple attribute for email input
- Issue with preventDefault call in bouncer library HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bouncer.