• Hello,

    I am using Contact Form 7 v5.6.1 on my local WP 6.0.1 installation with the default Twenty Twenty Two theme.

    I have noticed a bug when using checkbox fields on a contact form. The issue is when i toggle the checkbox on the frontend, it triggers a change event on the form causing all validation errors to appear.

    This is not expected behaviour and the validation should only be triggered when a user has submitted the form.

    If i remove the ‘change’ event handler from the WPCF form DOM element, it works as expected.

    I’ve have captured a screen recording of the issue to help with your investigations.

    https://www.awesomescreenshot.com/video/10411987?key=e7b6af3dec2fce4a13f39454bbf51d60

    • This topic was modified 2 years, 7 months ago by lippiun.
Viewing 15 replies - 1 through 15 (of 24 total)
  • Thread Starter lippiun

    (@lippiun)

    Hi, any update on the above?

    It’s quite impossible to assist directly with a local server. You may have some other event handler involved, for example, but you’ll have to find it yourself or publish the site somewhere and share the public link.

    Thread Starter lippiun

    (@lippiun)

    Hi Gal,

    You can see the site here

    In your theme’s main.js, there’s a copy of https://fellowtuts.com/wordpress/contact-form-7-radio-checkbox-bootstrap-4-style/, which could be the culprit.

    Thread Starter lippiun

    (@lippiun)

    Hi,

    The bootstrap styling script isn’t the problem as the issue still persists after removing it.

    Even when i deactivate ALL plugins and switch to the default Twenty Twenty Two theme, the form is still validating after checking a checkbox. I can see the event handler for this is coming from your plugin.

    Thread Starter lippiun

    (@lippiun)

    You can replicate this issue by creating a fresh WP install on the following environment:

    WordPress v6.0.1
    Web Server: nginx
    PHP Version: 7.4.1

    Theme: Twenty Twenty Two

    Contact Form 7 Version: 5.6.2

    Then create a basic form with the following the fields:

    <label> Your name
        [text* your-name] </label>
    
    <label> Your email
        [email* your-email] </label>
    
    <label> Subject
        [text* your-subject] </label>
    
    [checkbox checkbox-340 use_label_element "Test"]
    
    <label> Your message (optional)
        [textarea your-message] </label>
    
    [submit "Submit"]

    Then, when you click on the checkbox you will the form validations appear.

    Time for @takayukister to get involved, I guess.

    Thread Starter lippiun

    (@lippiun)

    Hi,

    Any update on this?

    I’ve tested it on one of my sites and the problem happens there too, so this is an issue with the plugin. I’ve even isolated it to the “change” event handler form.wpcf7-form.init in includes/js/index.js.

    Unfortunately, that’s as far as I go.

    Try opening an issue for this on Github.

    Hi,
    any news on this?

    I tried to open an issue request on github which has been categorized as invalid and consequently removed (you can find original post screenshot here https://ibb.co/NKBdwRT)

    I wonder where I should ask for this then ??

    Thread Starter lippiun

    (@lippiun)

    Pretty crazy how I posted about this 4 weeks and the plugin developer still hasn’t answered. Yet he’s been answering newer questions…

    Be great to get an idea of when this will be fixed as it’s a bad customer experience at the moment.

    @lippiun did you manage to solve this bug temporarily?

    If i remove the ‘change’ event handler from the WPCF form DOM element, it works as expected.

    Could you explain please where could I do this?

    Thread Starter lippiun

    (@lippiun)

    I could onlyremove event listeners via the Chrome Developer Tools. I tried adding some custom code to remove it permanently but had no luck. I think this needs to be removed from the core index.js file

    @lippiun Maybe you shouldn’t have mentioned my name ??

    To point it out, I mentioned it, cause I thought you were an official supporter. My bad

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘Validation issue when checking checkbox fields’ is closed to new replies.