Untitled

 avatar
unknown
plain_text
a year ago
1.2 kB
4
Indexable
$(document).ready(function(){
    var chequeForm = [];
    var payeeForm = [];
    var isChequeFormValid = false;
    var currentForm = $('.single-payee-form');
    $('.finish-cheque-form').on('click', function(){
        isChequeFormValid = false;
        var cForm = $(this).closest('.modal-content').find('.single-payee-cheque-form');
            var serializedCform = cForm.serializeArray();
        $.each(serializedCform, function(index, element){
            console.log(index);
            console.log(element);
            if(element.value === ''){
                $(`[name='${element.name}']`).addClass('is-invalid');
                Toast.fire({
                    background: 'info',
                    icon: 'info',
                    title: `Missing Fields!`,
                    text: `All fields must be filled out`
                });
                isChequeFormValid = true;
            }else{
                $(`[name='${element.name}']`).removeClass('is-invalid');
            }
           
        });
        if(!isChequeFormValid){
            $(this).fadeOut();
            cForm.fadeOut();
            $('.cheque-form-back-btn').removeClass('visually-hidden');
        }
    });
    
});
Editor is loading...
Leave a Comment