Comments (7)
Okay, part of this resolved itself. I forgot to add novalidate
on the form
and was seeing the Chrome validation bubble.
This was especially confusing because the example page exhibits the same problem
from jqbootstrapvalidation.
Hi Oliver!
While hunting for the source of this, I noticed something weird at https://github.com/ReactiveRaven/jqBootstrapValidation/blob/1.3.6/jqBootstrapValidation.js#L288 It looked to me like
hasOverrideMessage
is alwaystrue
because the messages were set earlier. A simplealert(hasOverrideMessage)
confirms this.
If you do $("body").data("something-that-isnt-there")
you should get back undefined
, because that data-attribute isn't defined. In dev-master I've simplified this to var hasOverrideMessage = !!message;
to avoid confusion.
The value is read just fine using
$this.data("validationRequiredMessage")
, yet, the value isn't used. I confirmed this at https://github.com/ReactiveRaven/jqBootstrapValidation/blob/1.3.6/jqBootstrapValidation.js#L164
The pertinent bit there:
message = settings.builtInValidators.required.message;
if ($this.data("validationRequiredMessage")) {
message = $this.data("validationRequiredMessage");
}
overwrites the default with your message from the data-attribute, so if you can read it in jQuery, it should be using your message fine.
Okay, part of this resolved itself. I forgot to add
novalidate
on theform
and was seeing the Chrome validation bubble.This was especially confusing because the example page exhibits the same problem
I agree. I'm in the process of rewriting the docs, but its taking me far too long. I've been neglecting the current version of the docs. Sorry about that.
Could you highlight the part that hasn't resolved itsself? Are you seeing your validation message now?
Thanks
- RRaven
from jqbootstrapvalidation.
Hello @ReactiveRaven :)
As far as I can tell, my immediate problems were resolved. Adding the novalidate
to my forms made everything behave as expected.
What wasn't resolved was the incorrect example on the documentation page, but you already touched on that subject.
I'm still confused regarding this section of the code though. As you've pointed out, you adjusted that code in master. However, to my understanding, my observations should still be true. If settings.options.sniffHtml
is enabled, the message data members are explicitly set on all form elements: https://github.com/ReactiveRaven/jqBootstrapValidation/blob/master/dist/jqBootstrapValidation-1.3.6.js#L96.
For example, when putting required
on an input
, the data member will always be set. Thus, the hasOverrideMessage
variable should always be true
later on (even though the message wasn't actually overriden).
from jqbootstrapvalidation.
Ah, I understand now.
Yes, its not ideal. The easiest way of forcing a validator to be used is make sure a message is set for it, so thats what it does when it finds the 'required' attribute. I ran into this problem in master when adding tests and just went the easy way of making custom/default messages work for sniffed attributes. It still works, because the default message is being put in as the data-attribute that is overriding the.. default message. Convoluted, but you get the right result.
Its something I want to tidy up for 2.0 but it passes tests in master right now. I'll be coming back to this once I've got back in control of the issues list. Thanks for highlighting it :)
from jqbootstrapvalidation.
from jqbootstrapvalidation.
Hello.
I have 2 textboxes one user and password.
and even if the first one is ok, it keeps saying "enter signum" when it should be asking for password.
This is the code for the textboxes:
Thanks in advace
from jqbootstrapvalidation.
I finally got it!
all i did was clear the custom validity property on each textbox
placeholder="Signum" required oninput="setCustomValidity('')" oninvalid="this.setCustomValidity('Please enter Signum')"
:)
from jqbootstrapvalidation.
Related Issues (20)
- Destroy undoes validations
- I use jquery ui to change the selectmenu,how can i to validate the selectmenu?
- Pattern
- Warning Don't Show
- jqBootstrapvalidation callback validation function not working after form validation
- filter does not affect "required" item
- Deprecated dependency "jQuery" in package.json
- jsBootstrapValidation it's not working with Bootstrap-select HOT 1
- The email [email protected] is correct? HOT 1
- Not working properly with jQuery > 1.7.2 HOT 2
- Remove wrong Comments
- Please add to JSDelivr HOT 1
- Not required Select menu tag have a red borde HOT 1
- How can you dynamically trigger validation of a single field? HOT 2
- Regex not working, input is never seen as valid
- i have two issues with the jqBootstrapValidation
- Validation field depending respect another 2 fields
- An email address with a TLD longer than four letters (like ".today") is marked invalid
- Dynamic Validate Problem
- How to make it work in modal
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 jqbootstrapvalidation.