This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hi
Im trying to build a more pretty validation look for my forms. im using ValidationException with the data-request-validate & data-validate-error twig markup to show my errors which works fine. however RainLabs User plugin returns errors as standard javascript alert(). for example Auth::authenticate() which i want to output to the data-validate-error like the ValidationException.
is there a way to prevent the alerts() and use lets say ValidationException.
thanks
Just for anyone who has the same problem. heres the solution to catch the alert() message and append the data-validate-error.
$(window).on('ajaxErrorMessage', function(event, message){
if ($("[data-validate-error]").length ) {
// This will stop the default alert() message
event.preventDefault();
$("[data-validate-error]").addClass('visible');
$("[data-message]").text(message);
}
})
Last updated
Thank you @phplee ...
This helped a lot ... odd that data-request works for some exceptions but not all. Some I don't don't need to catch in the response like this
1-3 of 3