Home›Support›English Support›[Resolved] Translated version overrides querystring parameters in action property for a form
[Resolved] Translated version overrides querystring parameters in action property for a form
This thread is resolved. Here is a description of the problem and solution.
Problem:
The client is using different forms for each language version of a page, embedded via shortcodes from the Spotler/Mailplus plugin. The Dutch version of the form is overriding key parameters in the form action, affecting its submission.
Solution:
We recommend the following steps to address the issue:
1. Ensure that each language version of the page uses the correct form shortcode. Add them manually if necessary. 2. If preserving URL arguments through WPML settings does not resolve the issue, consider using custom code to maintain the correct form settings upon submission. 3. As a backup, implement a JavaScript snippet to modify the form action after the page loads. 4. If the problem persists, consider switching to a different form plugin that is more compatible with WPML. For more information on compatible form plugins, visit https://wpml.org/plugin-functionality/form/.
If these solutions do not apply to your case, or if they seem outdated, please open a new support ticket. We also 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. For further assistance, you can contact us directly through our support forum at WPML support forum.
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.
Background of the issue:
I am using a different design translation for a particular page on my site: hidden link is the original English version, and hidden link is the translated Dutch version. The issue involves the Spotler/Mailplus plugin, which we use for sign-up forms. We embed forms using a shortcode from their plugin, with different forms for each language to trigger different email automations. The current setup translates the URL and adds a querystring parameter, which overrides a key property for form submission. For example, the form element with id form2003 on the English page has actionid and formid parameters, but the Dutch version with id form2203 has the lang property that overwrites these parameters. I tried the setting under Languages/Language switcher options to preserve URL arguments, but it seems to only apply to querystring parameters in the location.href. The English version does not feature those params in the URL for the form to work. This form embedding method preserves the layout and syncs with changes in the email platform. I considered changing the querystring setup to different directories for different languages but am unsure of the impact or if it would solve the issue.
Symptoms:
The translated version of the form overrides querystring parameters in the action property, affecting form submission.
Questions:
Is there any way, other than adding a script that would change the action property in the client, to influence what is going on here and make sure the form submits correctly, preserving the params?
Now you are using different forms (via shortcodes) for each language version of your page. However, the translated Dutch form is overriding some key parameters in the form action, which affects submission. Am I correct?
If so, please consider one of the following workarounds and let us know your feedback.
Use the correct form shortcode for each language – Make sure each page has the right shortcode for its form. Please add them manually if needed.
Use custom code to keep the form settings – WPML’s setting to preserve URL arguments may not help here. Use a small code snippet to make sure the form keeps the correct settings when submitted.
Use JavaScript as a backup – If the above doesn't work, you can add a small script to change the form action after the page loads.
Try another form plugin – If it is still not working, you can use a form plugin that works better with WPML. Refer to this post for more information: https://wpml.org/plugin-functionality/form/
Thanks for this!
You understand me correctly indeed. Not sure what you mean by the first two points though, are you referring to the code from the emaiplatform/embedded form?
But to summarize, I think you are saying: there is not much WPML can do about this - not complaining, just stating - and a workaround that resets the params seems most sensible?
Thank you for the updates. This seems to be a compatibility issue with the Spotler plugin, which is not listed among our officially compatible plugins.
In such cases, the usual workaround is to manually place the correct signup form shortcode (e.g., the Dutch form) on the translated page.
To help us understand the issue better, could you please share a screencast of the problem? You can upload it to Google Drive and share the link with us. This will be very helpful for our internal discussions.
Your suggestions confirmed my first approach to just override this with JS, since indeed this seems like an unsupported edge case. This works, so thanks!