bootstrap-validator
bootstrap-validator copied to clipboard
How to exclude validation for those field which is inside hidden Div
I couldnot able to findout solution so please give me some idea how to troubleshoot this issue. Here is the sample even i added "required" attribute in checkbox that is no visible for guest so only when it's visible validation should work else it shouldnot be.
<form data-toggle="validator" role="form" id="testform">
<div class="form-group">
<label for="inputName" class="control-label">Name</label>
<input type="text" class="form-control" id="inputName" placeholder="Cina Saffary" required>
</div>
<div class="hiddenDiv">
<div class="form-group ">
<div class="checkbox">
<label>
<input type="checkbox" id="terms" data-error="Before you wreck yourself" required>
Check yourself
</label>
<div class="help-block with-errors"></div>
</div>
</div>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</form>
Simply you can hide your input by css .hiddenDiv input { display:none; } Error will show but input will be hidden and you can also use bootstrap hidden class to do this.