Support » Plugin: Conditional Fields for Contact Form 7 » Conditions Stopped Working

  • Resolved DigTek

    (@digtek)


    Hello,
    A few weeks ago an update caused me to lose all my conditions and Conditional Fields for Contact Form 7 stopped working.
    I was able to load a backup and restore the conditions which got it working then, but it seems another update has caused the same issue (conditions not working), but they are still there this time.
    I plan to swap in an older version later, WordPress and all my plugins are up to date.
    I use only Flamingo and ‘Contact Form 7 – Dynamic Text Extension’ with Conditional Fields for Contact Form 7, disabling them did not resolve the issue.
    Conditional Fields for Contact Form 7 @ 2.1.6
    Contact Form 7 @ 5.5.6.1

Viewing 15 replies - 1 through 15 (of 20 total)
  • Plugin Author Jules Colle

    (@jules-colle)

    There were some problems with version 2.1.5 indeed. You would loose conditions if you had more than 50 and thus were forced to use text view.
    These issues have now been resolved, so the issue you are having now (conditions not working) is probably related to something else. The first thing I would like you to check if if you see any relevant JS errors on your page. It could help to quickly run trough this troubleshooting guide and let me know what you find: https://conditional-fields-cf7.bdwm.be/docs/troubleshooting/does-not-work-with-a-third-party-theme-or-plugin/

    Thread Starter DigTek

    (@digtek)

    I do get this is the console:

    Uncaught TypeError: Cannot read properties of undefined (reading 'get')
        at Object.get_simplified_dom_model (scripts_es6.js:1229:24)
        at wpcf7cf_reload_dom (scripts_es6.js:72:27)
        at Object.get_nested_conditions (scripts_es6.js:1143:9)
        at ./js/scripts_es6.js.Wpcf7cfForm.updateGroups (scripts_es6.js:463:38)
        at new Wpcf7cfForm (scripts_es6.js:228:10)
        at HTMLFormElement.<anonymous> (scripts_es6.js:1532:24)
        at Function.each (jquery.min.js:2:3003)
        at s.fn.init.each (jquery.min.js:2:1481)
        at ./js/scripts_es6.js (scripts_es6.js:1531:23)
        at __webpack_require__ (bootstrap:19:1)

    If I revert to a backup running 2.1.3 and clear my cache everything works fine, once I go back to 2.1.6 the problem returns. Specifically, the form loads, and everything outside of groups works, the form will submit, send the email and log to flamingo. I have not changed anything on the site other than running updates for months.

    Don’t take this wrong, it is just an observation about troubleshooting guide’s that suggest sites with 50+ plugins, some that are required for things to work properly in the first place, can just be disabled to test a plugin – my experience is that the easiest way to handle broken plugins after an upgrade is to simply restore the last working version and edit the file so it will not auto-update, which is much faster and easier. I can then check back at a later date, when usually a newer version does fix the issue. The other option is to just switch to another plugin offering the same function that is not broken, also faster and easier in most cases (though it would not be here due to the number of conditions in use).

    Plugin Author Jules Colle

    (@jules-colle)

    Maybe some kind of caching or JS optimisation plugin that’s causing trouble?

    Do you have a link to your page?

    Plugin Author Jules Colle

    (@jules-colle)

    Could you run this code in your console?

    Object.getOwnPropertyDescriptor(Element.prototype, "children")

    It should return an object. If it returns undefined or an error, this might mean that your browser is not supporting it (Internet Explorer), or that some code on your website has somehow removed the property.

    Version 2.1.4 includes a change that allows the use of the name “children” for a field. Prior to this update is was impossible to use children as a name. This change seems to somehow interfere with your current setup. I’m eager to find out what is causing the conflict, so if you can give me a basic setup (minimum amount of plugins and themes) that causes the same problem, that would be very helpful for finding a fix.

    Thread Starter DigTek

    (@digtek)

    That does return undefined.
    I spent over an hour looking at some (recently updated) plugins, but with over 60 in use and more than a few required for the site to work, I ended up rolling back to 2.1.3, which works fine even with WP core fully up to date. I cannot easily provide a link, the form is private and deals with sensitive data. I am still fine trying to help, the site is somewhat modified, with many pages driven by custom php code, but that form itself only uses the Dynamic Text Extension plugin and CF7/Flamingo, which are not modified.

    Plugin Author Jules Colle

    (@jules-colle)

    Interesting. Does it also return undefined when you open your console on any other website? (for example this one)

    Thread Starter DigTek

    (@digtek)

    Both here and on my site running 2.1.3 I get no errors, and this is returned:
    {set: undefined, enumerable: true, configurable: true, get: ƒ}

    Plugin Author Jules Colle

    (@jules-colle)

    Wait, what? On the site where you are running version 2.1.3 Object.getOwnPropertyDescriptor(Element.prototype, "children") doesn’t return undefined?

    But once you update the plugin to version 2.1.6, and you enter Object.getOwnPropertyDescriptor(Element.prototype, "children") in the console, it returns undefined?

    Is that correct?

    Thread Starter DigTek

    (@digtek)

    Hmm.
    Sorry.
    Maybe I did something funny (like was on a different site somehow) when I got the:
    {set: undefined, enumerable: true, configurable: true, get: ƒ}

    Because now it is undefined when using either 2.1.3 or 2.1.6.
    I have both backed up locally and can ftp them in as needed (or use WP Rollback).

    Plugin Author Jules Colle

    (@jules-colle)

    OK, so this means that a piece of code on your website is removing an essential DOM function from JavaScript. Not sure if you are familiar with JavaScript, but removing base functionality from JavaScript seems like a very sketchy business.

    One extreme example would be to execute this code in a plugin: delete Object
    This piece of code which might seem totally harmless will cause your entire website to crash.

    Now, I’m guessing that there’s a piece of code on your website, that is doing something like this: delete Object.getOwnPropertyDescriptor. I would scan for a line like this, or any line doing funky things to the Object.getOwnPropertyDescriptor, and see if removing that line fixes your problem.

    Thread Starter DigTek

    (@digtek)

    How would I go about scanning for something like that, nothing shows up in the source.

    Plugin Author Jules Colle

    (@jules-colle)

    You would need to download your entire WordPress folder, and open it with a text editor like Visual Studio Code (which is free), then you can easily enter a search term and it will show you all the matching pieces of code in all your files.

    Thread Starter DigTek

    (@digtek)

    OK
    Notepad++ does it also I see, the folder is already in my local network.

    delete Object.getOwnPropertyDescriptor
    does not show up at all

    Object.getOwnPropertyDescriptor
    shows up over 600 times, often in the includes folder js files
    It also shows up in plugins, but they are mainstream plugins and disabling them did not change the issue.

    Is there a more specific or alternate search I can run?

    It may be worth noting that there are no other problems with the website that has been running since 2013, so while I am not disputing the fact that other websites I checked are not returning undefined, it is not ‘crashing my entire website’ either, only your newer plugin versions are affected, everything else is and has been fine.

    Plugin Author Jules Colle

    (@jules-colle)

    could you maybe email me the url of your website privately? You can find my email address on bdwm.be

    If not, I’m wondering if Object.getOwnPropertyDescriptor returns anything other than ƒ getOwnPropertyDescriptor() { [native code] }

    Plugin Author Jules Colle

    (@jules-colle)

    I’m also interested in the output of these commands:

    Element

    Element.prototype

    Object.getOwnPropertyNames(Element.prototype)

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘Conditions Stopped Working’ is closed to new replies.