This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This thread is resolved. Here is a description of the problem and solution.

Problem: The user's Gravity Forms Conditional Logic code stopped working for the secondary language. The cause was a known issue in the Gravity Forms Multilingual Plugin.

Solution: - Go to Plugins -> Plugin Editor - Select “Gravity Forms Multilingual” from the dropdown and click “Select” - Click on “classes” in the list of files and folders on the right of the page - Find and click on “class-gfml-conditional-logic.php” as shown in the screenshot - Scroll down to Line 27 and replace:

if ( array_key_exists( 'text', $translated_rule ) ) { $rule['value'] = $translated_rule['text']; } elseif ( array_key_exists( 'value', $translated_rule ) ) { $rule['value'] = $translated_rule['value']; }

With

if ( array_key_exists( 'value', $translated_rule ) ) { $rule['value'] = $translated_rule['value']; } elseif ( array_key_exists( 'text', $translated_rule ) ) { $rule['value'] = $translated_rule['text']; }

- Click “Update File”

This topic contains 3 replies, has 2 voices.

Last updated by Izzi Hassan 2 weeks, 5 days ago.

Assigned support staff: Izzi Hassan.

Author Posts
September 26, 2019 at 6:04 am #4643641

martinM-27

Hi there,

This is a repeat problem that I originally raised in this thread:

https://wpml.org/forums/topic/conditional-logic-not-working-on-translated-forms/

The problem was fixed at the time, following the steps in that thread, but has recurred and I have taken all the steps set out in thread again - i.e.:

- I have made sure that the 'Show Values' check box is checked on all drop down fields
- I have resubmitted the form for translation
- On the translation page I have confirmed that all the values are identical and all the labels have been translated

However, the drop down fields still do not work when the form is viewed in Chinese.

Here is the form (English version):

hidden link

Great if you can point me in the right direction,

Cheers,

Martin.

September 26, 2019 at 1:25 pm #4647203

Izzi Hassan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for reaching out and I apologize for the inconvenience of having to deal with similar issues twice.

I cannot be completely certain until we try a solution, but I believe this to be related to a similar issue we have come across recently with the Gravity Forms Multilingual Plugin. Could you try the following steps and see if that resolves your issue? It will also help us fix this in the next version of the plugin.

You will need to modify a file in the Gravity Forms Multilingual plugin.

IMPORTANT: I recommend taking a backup of your site or trying this out in a test environment first. Your live site might go down if you make a mistake while modifying a plugin file.

If you’re not comfortable with doing this yourself, you can also let us make a test site and try out the solution there before helping you apply it to the live site. In order to do this, we will need to get a site backup from you. We recommend using a plugin like Duplicator to create site backups:
https://wordpress.org/plugins/duplicator/

If you are comfortable with trying to resolve this yourself, you can edit this file by following these steps:

- Go to Plugins -> Plugin Editor
- Select “Gravity Forms Multilingual” from the dropdown and click “Select”
- Click on “classes” in the list of files and folders on the right of the page
- Find and click on “class-gfml-conditional-logic.php” as shown in the screenshot
- Scroll down to Line 27 and replace:

if ( array_key_exists( 'text', $translated_rule ) ) {
$rule['value'] = $translated_rule['text'];
} elseif ( array_key_exists( 'value', $translated_rule ) ) {
$rule['value'] = $translated_rule['value'];
}

With

if ( array_key_exists( 'value', $translated_rule ) ) {
$rule['value'] = $translated_rule['value'];
} elseif ( array_key_exists( 'text', $translated_rule ) ) {
$rule['value'] = $translated_rule['text'];
}

- Click “Update File”

Now, if you refresh the form page, it should work in both languages once again.

Do let us know if you are able to get the form working again using this process. If you have further issues, I’ll be happy to provide more assistance when we hear back from you.

September 26, 2019 at 10:50 pm #4650527

martinM-27

Hi Izzi,

That did the trick - all good now.

Many thanks for your help! (My apologies - I should have pressed 'My issue is resolved', but I pressed the wrong button)

Cheers,

Martin.

September 27, 2019 at 3:36 am #4651479

Izzi Hassan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Martin,

No problem! I'm glad we were able to resolve the issue and I'll mark this as resolved.

Please don't hesitate to reach out if you need further assistance!