Reputation: 256
i am working on bootstrap validation. on page load, form is showing. user can load and remove same form by add more/remove links. i have done this using jquery. To post data of all the forms, i am using array name like name="email[]".
i have done bootstap validation using bootstrap validator but it is not working. Any help please...
here is my bootstrap validator code
<script type="text/javascript">{literal}
$(document).ready(function() {
$('#save_form').bootstrapValidator({
message: 'This value is not valid',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
ind_email[]: {
validators: {
notEmpty: {
message: 'The email address is required and can\'t be empty'
},
emailAddress: {
message: 'The input is not a valid email address'
}
}
}
}
});
});
here is the html code
<form action="{$data.action}" method="post" enctype="multipart/form-data" name="save_form" id="save_form" class="form-horizontal"
data-bv-feedbackicons-valid="glyphicon glyphicon-ok"
data-bv-feedbackicons-invalid="glyphicon glyphicon-remove"
data-bv-feedbackicons-validating="glyphicon glyphicon-refresh">
<div class="form-group">
<label class="col-sm-3 control-label">Email Address:</label>
<div class="col-sm-5"><input type="text" name="ind_email[]" value="" id="email1" class="form-control"/></div>
</div>
Upvotes: 4
Views: 3708
Reputation: 103
quotes are missing. Also, specify the group. Try this
'ind_email[]': {
group: '.col-sm-5',
validators: {
Upvotes: 3