-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to override validationRequiredMessage #53
Comments
Hi Oliver!
If you do
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.
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
|
Hello @ReactiveRaven :) As far as I can tell, my immediate problems were resolved. Adding the 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 For example, when putting |
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 :) |
No description provided. |
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')" :) |
Even if I set data-validation-required-message on my input box, I still get the default error message.
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#L164While 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.So, I'm somewhat confused about what's going on.
The text was updated successfully, but these errors were encountered: