Hi everybody,
I’m only a beginner at wix coding and I wrote the following code, but it’s not working as coded.
$w . onReady ( function () { let language = wixWindow . multilingual . currentLanguage if ( language === “nl” ) {
$w ( ‘#form1’ ). show ()
$w ( ‘#form2’ ). hide ()
} else if ( language === “fr” )
{
$w ( ‘#form1’ ). hide ()
$w ( ‘#form2’ ). show ()
}
});
On startup with the language “nl”, form1 shows up and not form2 as it should be. Then when changing the language to “fr” there are no forms to be seen any more.
When going back to “nl” no forms are showing up any more, not even the one that showed up at startup…
Can anyone help me and put me on the right track please.
Maybe I got something wrong or are forgetting a part of code?
Hi,
I haven’t published it as it doesn’t work. I’m still trying to get it working in preview mode.
Even tried it by writing the code in a separate function and it still doesn’t work.
Create a page for development only, set it so search engines will not index it, publish and test, because preview mode doesn’t always reflect the live site behavior(especially when it comes to wixWindow methods).
Tried that too and still not working.
There’s a problem with wix forms using multilingual.
I started with 2 forms on the same page. 1 for the “nl” language and one for the “fr” language. So as it didn’t work out, I thought that the problem was 2 forms on 1 page. So I changed it again to 1 form to test and even then it doesn’t work.
So say you have a page with a form named “#form1”
Say you are in the multilingual “nl” (editor mode).
Then the value of “#form1” should be visible
Until there no problem.
When switching to the multilingual “fr” (editor mode)
Then the value of “#form1” should be hidden
And there’s the problem…
When setting the value of a form to “Hidden”, the value stays the same in both languages. So visible in multilingual “nl” means also visible in multilingual “fr”. Hidden in multilingual “nl” means also hidden in multilingual “fr”…
Even with code it doesn’t work…
So the main problem is that a form’s “hidden” value isn’t changeable when changing languages. By that I mean that it’s not like the translating possibility of a textbox. When changing from multilingual “nl” to “fr” the text you translated in the corresponding language is shown.