form-contact-form-7

Việc người dùng sau khi điền thông tin và nhấn nhiều lần vào nút gửi form trong contact form 7 như hình trên sẽ dẫn đến tình trạng trùng lặp thông tin.

Để tránh tình trạng trùng lặp thông tin do gửi form nhiều lần bạn hãy chèn đoạn mã js sau vào website của bạn.

jQuery('.wpcf7-submit').click(function (event) {
    let thisElement = jQuery(this);
    thisElement.css('pointer-events', 'none');
    let oldVal = thisElement.val();
    let textLoading = 'Processing ...';
    thisElement.val(textLoading);
    document.addEventListener('wpcf7submit', function (event) {
        thisElement.val(oldVal);
        thisElement.css('pointer-events', 'auto');
    }, !1);
});

 

 

Bài viết liên quan

post-no-image

Tuỳ biến phần search WordPress chính xác hơn, tìm kiếm theo tiêu đề

post-no-image

Cách quét và tìm virus trong Database WordPress để loại bỏ mã độc Malware

post-no-image

Hướng dẫn custom Multiselect box

post-no-image

Hướng dẫn tạo email template để gửi mail qua: Outlook App, Outlook website, Gmail, Apple Mail…

post-no-image

Hướng dẫn tắt tính năng mua hàng nhưng vẫn hiển thị giá trong Woocomerce

post-no-image

Hướng dẫn tạo mã QR code và Barcode trong php