Ho un modulo con 2 pulsanti. Un pulsante invia il modulo in formato Ajax e un altro pulsante invia il modulo in modo normale.Modulo BootstrapValidator invio non funzionante
$('#form_createAd').bootstrapValidator({
submitHandler: function(validator, form, submitButton) {
if (submitButton.attr('value') == "cart"){
submit_cartDetails(); //This function submits details thru ajax post
} else {
form.submit(); // Also Tried $('#form_createAd').submit()
}
}, fields: {
title: {
message: 'The username is not valid',
validators: {
notEmpty: {
message: 'The username is required and can\'t 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, dot and underscore'
}
}
}
}
});
Questa è la parte HTML Dei Tasti All'interno Sezione Modulo
<button id="cart" value="cart" class="btn btn-primary" >Add To Cart</button>
<button type="submit" name="submit" value="proceed" class="btn btn-success">Proceed</button>
Il modulo non presenta. Che cosa ho fatto di sbagliato?
Si prega di essere più consapevoli quando taggare la tua domanda. Il tag [tag: jquery-validate] non è lo stesso del plug-in Validator Bootstrap. – Sparky
Ho riscontrato lo stesso problema. Utilizzo di BootstrapValidator 0.5.1 –