jqBootstrapValidation
jqBootstrapValidation copied to clipboard
Unable to Get Data Validation Messages To Work
I left a comment in number 56, but that issue was closed (without explanation of how it was resolved).
I am having the same issue the OP had in #56 - namely the validation messages aren't appearing, and adding novalidate just allows the form to submit.
I am using jquery 1.9.1, don’t know if that would matter.
This is the jquery I'm using for the validator:
$().ready(function(){
$("input,select,textarea").not("[type=submit]").jqBootstrapValidation();
And this is the HTML:
<div class="span4">
<label for="projcode-cost-center" class="required">Project Code/Cost Center*</label>
<input id="projcode-cost-center" name="projcode-cost-center" type="text" required placeholder="Project Code/Cost Center" data-validation-required-message="A Project Code/Cost Center is required.">
</div>
+1 on this, it always gives me the default browser message.
I'm having the same issue with jquery 1.9.1
+1 same problem but the message are personalized in the demo. Seem buggy on FF only, ok on chrome.
Same issue here with jquery v1.10.2 any idea on how to fix it?
Your fields needs to have this basic structure:
<div class="control-group">
<label for="some_field">Your label</label>
<div class="controls">
<input type="text" name="some_field" required>
</div>
</div>
Watch out for the classes "control-group" and "controls", they're required in each input you want to validate with this plugin!
Oeps, I missed the
@robred, could you create a JSFiddle or Plunker to reproduce this?
This code worked for me with Bootstrap 3, Jquery 1.10.2 and jqBootstrapValidation 1.3.6.
<form novalidate>
<div class="control-group">
<label for="some_field">Your label</label>
<div class="controls">
<input type="text" name="some_field" class="form-control" required data-validation-required-message="This field is required.">
<p class="help-block"></p>
</div>
</div>
<button class="btn btn-primary pull-right" type="submit">Submit</button>
<br />
</form>
<script>
$(document).ready(function() {
$("input,select,textarea").not("[type=submit]").jqBootstrapValidation();
});
</script>
Jsfiddle example
http://jsfiddle.net/Onelove/2Cyph/
The comment about "control-group" and "controls" was what helped me out. Thanks @acemir!
By the way I have found that version 1.3.6 has two variants floating around. One looks for "form-groups" and one doesn't. So it may work without "controls" and "control-group" and work with "form-groups" OR it may not!