My form has two submit buttons, one submits the main form and the other one sends data using ajax. Can't figure out how to tell bootstrap validator that in this case we are using different submit button. And yes on that submit im using preventDefault();
$("#submitformat").click(function( event ) {
$('#formid').bootstrapValidator({ // this id is correct
message: 'This value is not valid',
fields: {
alias: {
message: 'The username is not valid',
validators: {
notEmpty: {
message: 'The username is required and cannot be empty'
},
stringLength: {
min: 6,
max: 30,
message: 'The username must be more than 6 and less than 30 characters long'
},
regexp: {
regexp: /^[a-zA-Z0-9_]+$/,
message: 'The username can only consist of alphabetical, number and underscore'
}
}
},
}
});
HTML button:
<button type="submit" id="submitformat" class="btn btn-primary">Submit</button>