Change WPForm Error “Form has not been submitted, please see the errors below.”

I Create Some Custom Filed and this Error Message show when i click on the sumbit button without click on verify otp Button here is my Code

This code i use in functions.php
//Verify OTP

function enqueue_custom_wpforms_script() {
wp_enqueue_script(‘custom-wpforms’, get_template_directory_uri() . ‘/js/custom-wpforms.js’, array(‘jquery’), null, true);

// Localize the script with ajaxurl
wp_localize_script('custom-wpforms', 'wpforms_ajax', array(
    'ajaxurl' => admin_url('admin-ajax.php')
));

} add_action('wp_enqueue_scripts', 'enqueue_custom_wpforms_script');

function send_otp_via_proxy() { if (isset($_POST['mobile'])) { $mobile = sanitize_text_field($_POST['mobile']);

// Get the API endpoint from wp-config.php $api_endpoint = defined('API_ENDPOINT_OTP') ? API_ENDPOINT_OTP : 'https://dashboard.happylocate.com/api/v1/user/login/send-otp';

// Perform the POST request to the API $response = wp_remote_post($api_endpoint, array( 'body' => json_encode(array('mobile' => $mobile)), 'headers' => array( 'Content-Type' => 'application/json' ) ));

    if (is_wp_error($response)) {
        wp_send_json_error(array(
            'message' => 'Failed to send OTP',
            'error' => $response->get_error_message()
        ));
    } else {
        $body = wp_remote_retrieve_body($response);
        $data = json_decode($body, true);

        // Debugging: Log the full response
        error_log(print_r($data, true));

        if (isset($data['success']) && $data['success']) {
            wp_send_json_success(array(
                'message' => 'OTP sent successfully',
                'data' => $data['data']
            ));
        } else {
            wp_send_json_error(array(
                'message' => 'Failed to send OTP',
                'response_body' => $data
            ));
        }
    }
} else {
    wp_send_json_error(array('message' => 'Mobile number not provided'));
}
wp_die();

} add_action('wp_ajax_send_otp', 'send_otp_via_proxy'); add_action('wp_ajax_nopriv_send_otp', 'send_otp_via_proxy');
**This is Our Java Script Code(wpform.js) ** jQuery(document).ready(function ($) { $('#verify-otp-btn').click(function (e) { e.preventDefault();
    
var mobileNumber = $('#wpforms-22167-field_3').val(); // Mobile field ID
    console.log('Mobile Number:', mobileNumber); // Log mobile number

    if (mobileNumber) {
        console.log('Sending OTP request...');
        $.ajax({
            url: wpforms_ajax.ajaxurl, // Use the localized ajaxurl
            method: 'POST',
            data: {
                action: 'send_otp',
                mobile: mobileNumber
            },
            beforeSend: function() {
                console.log('AJAX request is about to be sent.');
            },
            success: function (response) {
                console.log('Response:', response); // Log the entire response

                // Correctly accessing the UUID from the response
                if (response.success && response.data && response.data.data && response.data.data.uuid) {
                    var uuid = response.data.data.uuid;
                    console.log('Captured UUID:', uuid); // Debugging: Log the UUID

                    // Store the UUID in the WPForms fields
                    $('#wpforms-22167-field_20').val(uuid); // Hidden field
                    $('#wpforms-22167-field_21').val(uuid); // Single-line text field
                    
                    alert('OTP has been sent to your mobile number.');

                    // Show the OTP input field container
                    $('#wpforms-22167-field_19-container').show();

                    // Change the button text to "Resend OTP"
                    $('#verify-otp-btn').text('Resend OTP');

                    // Disable the button for 1 minute
                    disableResendOtpButton();

                } else {
                    // Handle cases where the UUID is not found or success is false
                    console.error('UUID not found or success not true in response:', response);
                    alert('Failed to send OTP. The response was invalid.');
                }
            },
            error: function (xhr, status, error) {
                console.error('Error sending OTP:', error); // Log error response
                alert('Failed to send OTP. Please try again.');
            },
            complete: function() {
                console.log('AJAX request completed.');
            }
        });
    } else {
        alert('Please enter your mobile number.');
    }
});

function disableResendOtpButton() {
    var $button = $('#verify-otp-btn');
    var $timer = $('<span id="otp-timer"></span>');
    $button.after($timer); // Add the timer next to the button
    $button.prop('disabled', true); // Disable the button

    var timeLeft = 60; // 60 seconds countdown

    var timerInterval = setInterval(function() {
        timeLeft--;
        $timer.text(' (' + timeLeft + 's)'); // Update the timer text

        if (timeLeft <= 0) {
            clearInterval(timerInterval);
            $timer.remove(); // Remove the timer text
            $button.prop('disabled', false); // Re-enable the button
        }
    }, 1000);
}

});

i want to Replace this error
enter image description here

with this message “Please verify the OTP before submitting the form”

type here

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật