Use Bootstrap form validation
Hello,
This is a really nice Bootstrap validated form:
https://codepen.io/jaycbrf/pen/iBszr
Is there a way to use jQuery to initiate the WebAssist Insert behaviour?
The success snippet below shows a success message and then submits via Ajax.
It seems we would only need for the Ajax submit part to allow basic form submission but be blocked if there were still unsuccessful validation elements present. In other words do not allow form submission unless validation is successful then let the WA MySQLi Insert behaviour take over once allowing the form submission.
Does that make sense? Right now the form is still submitting so working on resolving that part currently.
.on('success.form.bv', function(e) {
$('#success_message').slideDown({ opacity: "show" }, "slow") // Do something ...
$('#contact_form').data('bootstrapValidator').resetForm();
// Prevent form submission
e.preventDefault();
// Get the form instance
var $form = $(e.target);
// Get the BootstrapValidator instance
var bv = $form.data('bootstrapValidator');
// Use Ajax to submit form data
$.post($form.attr('action'), $form.serialize(), function(result) {
console.log(result);
}, 'json');
});