Home›Support›English Support›[Resolved] Elementor Form Validation Error on Translated Pages (WPML Conflict Suspected)
[Resolved] Elementor Form Validation Error on Translated Pages (WPML Conflict Suspected)
This thread is resolved. Here is a description of the problem and solution.
Problem: You are using Elementor forms on a multilingual website powered by WPML and encountering issues where the form fails to submit on translated pages linked via WPML. Additionally, some global widgets created in Elementor are not rendering properly on these translated pages. Solution: To address the form submission issue on translated pages, follow these steps: 1. Add the following code to your functions.php file:
This code ensures that the AJAX request for the form submission is processed in the correct language context.
Please note that this solution might be outdated or not applicable to your specific case. If the issue persists, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If necessary, please open a new support ticket at WPML support forum for further assistance.
50% of people find this useful.
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.
I see the video, but I am not sure if there are any difference on your live website. I have checked on staging and there it works fine.
1) I have also done next on your staging site, create new page and added form, then translated it via CTE editor and it works fine.
- hidden link
I guess the problem was in your approach, as said it will cause problems. It works fine if you translate it via recommended methods. Best would be to deleted translated pages complete from website and then re-translate via correct methods, CTE, ATE or manual.
thanks for getting back, that is actually very helpful since at least we have now a steps to test the issue.
Unfortunately I have done same steps as you did and it works fine for me, so I still can not confirm the issue, since in almost all cases when I create a new page, or re-translate with any method it works fine:
Please check video:
- hidden link
Can you try again the same and maybe spot a difference in steps or maybe something from your side like browser addon is causing some issue on saving page?
It seems you haven’t fully replicated the issue yet, so I’d like to walk you through the steps to reproduce it — although they are also shown in the video I shared earlier:
1. Create a new page in English.
2. Set the page template to “Elementor Full Width” (this was not done in your video).
3. Edit the page with Elementor and add a form widget.
4. Remove any special characters from the form, just in case.
5. Save the changes.
6. Open the page in incognito mode and test the form — it works.
7. Go back to the WordPress editor and, in the WPML panel on the right, select “WordPress Editor” > “Only this page”.
8. Choose Dutch (or any other language) and proceed to duplicate the page.
9. Click the pencil icon to edit the Dutch.
10. On the lateral wpml panel, click on "Translate independently"
11. Save page.
12. Edit with elemetnor
13. Editing the page with elementor -> remove the form from the page and drag and drop a new one.
14. Again, remove any special characters from this new form.
15. Save the page and test it in incognito mode.
Video: hidden link
Result:
The form on the Dutch page fails validation, while the form on the English page works fine.
If we unlink the translation between the two pages, both forms work perfectly. The issue only occurs when the translation is linked to the default language.
Please, I kindly ask you to review the video I shared or try to replicate the exact steps above. Based on everything I’ve tested, I strongly suspect this is related to WPML String Translation.
Thank you again for your time and dedication in helping me with this issue.
Thank you, Drazen, for your support — we finally managed to identify the issue.
The code snippet you provided does fix the validation error.
However, please note that even with the latest plugin version 4.7.6, which I believe was intended to address this, the issue still persists. The problem is not resolved in version 4.7.6.
In the end, due to this issue, I’ve decided to change the structure and workflow of my website. I’m sharing this here in case it’s useful to anyone facing a similar situation:
• Now, only the contact pages include forms, and these contact pages are not linked as WPML translations. This avoids the validation error.
• All landing pages no longer contain forms directly. Instead, they now have buttons that link to the appropriate contact page in the desired language.
It’s not the most ideal solution, but it’s easier to manage and monitor.
The code contains a potential problem: it does not check whether $_POST[“post_id”] exists before accessing it, which can lead to a PHP error if the key is missing. In addition, the function should ensure that the inputs are validated to avoid security vulnerabilities. Here is the corrected and improved code:
function wssupp_set_language_ajax_form() {
// Check if post_id is set and is a number
if ( ! isset( $_POST[“post_id”] ) || ! is_numeric( $_POST[“post_id”] ) ) {
wp_send_json_error( “Invalid or missing post ID” );
return;
}