Hi, i find it cool using sweetalert in my website, but then i got lost after implementing it on my form validation. If i have errors in validation the sweetalert still pops up.
here is what i have in my script
<script>
$('#saveSettings').on('click',function(e){
e.preventDefault();
var form = $(this).parents('form');
swal({
title: "Success!",
timer: 1000,
showConfirmButton: false
}, function(){
form.submit();
});
})
</script>
I don't see anywhere in this script where you are validating the form. It looks like you are just grabbing the form and then activating a sweetalert box. you would need something like this:
if( form.isValid() ) {
swal({...
} else {....
where isValid() is some custom function that decides if the form is completely filled.