• Resolved George

    (@quantum_leap)


    I have two forms that are not sending emails:
    First form
    I get Error: Your form is not valid, please fix the errors!after submitting the form.
    Second form
    I get

    Error –>{“success”:true,”data”:{“insert_id”:572,”result”:{“message”:”

    Thank you for your message. We will get in touch with you shortly.<\/p>”,”action”:”hide_form”},”error”:””}}

    What is going on? I don’t want to publish the forms here, please suggest alternative ways to solve the issue!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi @quantum_leap

    I hope you are doing great today. Sorry to hear that you’ve experienced an error while using Forminator!

    To further investigate this issue could you please export your form?https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#import-export?to pastebin.com or Google Drive and share the link?

    Kind regards,
    Olumide Akintunde

    Thread Starter George

    (@quantum_leap)

    Here it is:

    Form 1

    Form 2 is a different form plugin (on a different site) so I am not including that, apologies!

    Hi @quantum_leap

    Thanks for the exporting the file. I tested the form on my website and I was able to submit the form without any issues or error messages. I’d suggest that you perform a full plugin/theme conflict test to identify the cause of this issue.
    Before you embark on this please make sure you do a complete backup of your website(Preferably, perform the test in a staging site)

    Steps;

    1. Deactivate all plugins except Forminator
    2. Switch to a basic theme as Twenty Twenty Two

    To learn more about how the plugin conflict test is executed, please see this guide below:
    https://wpmudev.com/docs/getting-started/getting-support/#conflict-test

    Check out this handy flowchart of the troubleshooting process detailed above.
    https://wpmudev.com/wp-content/uploads/2015/09/Support-Process-Support-Process.gif

    Kind regards,
    Olumide Akintunde

    Thread Starter George

    (@quantum_leap)

    Hi there, I found the issue. I have this code in my functions.php file:

    Is it possible to only assign it for a particular form?

    Hi @quantum_leap
    I am glad you’ve identified the issue.

    The purpose of the code you provided is to check if the two emails provided by users in a form are accurate. However, if you create a normal form without this logic ( verifying two emails) an error will occur.

    Answer to your Question:
    Yes, you should be able to make this code work for a particular form. To do this use the modified code below

    add_filter('forminator_custom_form_submit_errors', 'check_form_data', 99, 3);
    
    function check_form_data($submit_errors, $form_id, $field_data_array) {
        // Check if the form ID matches the specific form you want to target
        if ($form_id === 'enter the form id here') {
            $email1 = $email2 = '';
            foreach ($field_data_array as $arr) {
                if ($arr['name'] == 'email-1') $email1 = $arr['value'];
                if ($arr['name'] == 'email-2') $email2 = $arr['value'];
                if ('' != $email1 && '' != $email2) break;
            }
    
            if ($email1 != $email2) {
                $submit_errors[]['email-2'] = 'The email addresses must match!';
            }
        }
    
        return $submit_errors;
    }
    

    Note: Please add the form ID you want this code to work within the if ($form_id === 'enter the form id here') { of the code provided above.

    After this process, Save the file and retest the form.

    Best regards,
    Olumide Akintunde

    Thread Starter George

    (@quantum_leap)

    That did the trick, thanks!

    Hi @quantum_leap

    I’m glad i was able to help.

    Cheers

    Plugin Support Nebu John – WPMU DEV Support

    (@wpmudevsupport14)

    Hi @quantum_leap,

    Glad to see that @olumide22 was able to help you resolve the issue.

    Please feel free to open a new thread if need any further assistance, we are happy to help.

    Kind Regards,
    Nebu John

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Error: Your form is not valid, please fix the errors!’ is closed to new replies.