This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
For example, the user login throws javascript alerts after the validation is performed by laravel's validation. In fact, I have formvalidation.io validation code. Can I make the native way behave the same way as formvalidation.io? if not, can I integrate the two? or worst case, I have to ditch the native way, and just use formvalidation.io? formvalidation.io also allow for ajax validation.. so validation can still happen from server side if one decides to do so..
thanks
I assume that you are using the Data Attributes API.
Use the Javascript API and you can define your own callback function to display the errors, this will stop the alerts being issued.
I trap all the errors returned by October, loop through them and apply an error class. e.g.
<form role="form" onsubmit="$.oc.stripeLoadIndicator.show(); $(this).request('contact::onMailSent',
{success: function(){
showSuccess()
},
error: function(jqXHR) {
showErrors(jqXHR.responseJSON)
},
complete: function(){
$.oc.stripeLoadIndicator.hide()
}
}); return false;
">
The showErrors function:
function showErrors(errs) {
$.each(errs.X_OCTOBER_ERROR_FIELDS,function(idx, val){
$('#' + idx).addClass('error').next('small.error').text(val).css('display','block');
})
$('.alert-box.warning').show();
}
Last updated
1-4 of 4