I believe this is also related to this bug: https://wordpress.org/support/topic/javascript-issue-14/
Will try to fix it by the end of the week.
Hi Jules
I just updated to version 1.7.9 and also updated my Contact Form Translation and the issue seems to persist.
Is there anything I can do to help you with this issue?
Thanks
Jay
If you could set up a minimal wp installation to illustrate the malfunctioning of the plugin, that might help. So you can tell me the steps and I can reproduce it.
Alright, I have set up a fresh WP Installation here (http://debug.hybridsupply.de) and installed
- Contact Form 7
- Contact Form 7 Conditional Fields
- Contact Form 7 Multilingual
- WPML Multilingual CMS
- WPML String Translation
- WPML Translation Management
There is a contact Form with a single field on the first page (which works, as it should): Entering something into the field, triggers some condition and a second field appears.
Using WPML and Contact Form 7 Multilingual (WPML Extension) I have translated the Form, the WPML way and it can be seen in the German Version of the page, yet the conditional logic is not working.
I tried to reproduce this but everything is working fine when I set up wpml.
I do see that conditions are an empty string, while it should be an empty array. I have a feeling that your problem will be solved if you go to your German form in the backend, open the conditional fields tab, make sure the conditions are present, and click save. Could you give that a try?
Or even better, could you quickly check if this works?
Go to plugins/cf7-conditional-fields/cf7cf.php and change the function at line 345 to this:
public static function getConditions($form_id) {
$options = get_post_meta($form_id,'wpcf7cf_options',true);
return is_array($options) ? $options : array();
}
Please let me know, if that works, and I will include the change in the next update.
Unfortunately, I could not notice a change after replacing the code.
I’m no developer, but it seemed to be a JS related issue to me, since I am getting the above mentioned error on page load of the translated (German) page.
TypeError: conditions.filter is not a function scripts.js:678:44
/cf7-conditional-fields/js/scripts.js?ver=1.7.9
I actually just updated Contact Form 7 Multilingual to 1.0.2 and checked the conditional Fields for the German version of my Contact Form and they are entirely missing.
There is also no JS error anymore.
A bit technical, but in case you want to know: You are right there was a JS error. But the error was caused because it reads a JSON string that is generated by PHP. The JSON string should contain an array for the conditions, but it did not. So, the JS error was actually caused by PHP not making sure it passes an array before generating the JSON string.
So at this point, I think the problem is resolved. You just need to make sure to add your conditions to the German form separately.
Ah I see, translating a Form does not copy the conditions? Should this be a feature request rather than a bug report?
You could ask WPML if they want to implement this. Nothing I can do about this for now. You can tell them they can contact me if there’s anything I can do on my part to make CF more compatible with WPML
Try this:
1. Go to WPML -> Settings -> Custom XML Configuration (tab).
2. Add this code and save.
<wpml-config>
<custom-fields>
<custom-field action="copy">wpcf7cf_options</custom-field>
</custom-fields>
</wpml-config>
Now the problem should be solved.
That looks very helpful. Thanks for sharing! <3