Jump to content

Dropdown option labels not accepted on contact form with translated version

Recommended Posts

Hi,

When we translate the options in the dropdown box of the contact form the website doesn't accept the translated version and produces an error:

For example on the original version the submitted data goes like this:

"select-df09032e-2778-42e9-a51d-2b5488ebbada":"Lecture de mon DH"

Meanwhile on the translated English version it goes like this:

"select-df09032e-2778-42e9-a51d-2b5488ebbada":"Reading my DH"

The system does not expect "Reading my DH" as value.

It is only translated the labels in the HTML source code as you can see and not touch the value to avoid such cases.

However, the form is being submitted by JavaScript code and the code is reading the translated label instead of the value when sending the data to the backend.

Is it possible to adjust the javascript code or to add code in order to read the option value instead of the option label, so there won't be any error while sending the form ?

Capture d’écran 2024-05-02 à 16.28.22.png

Link to comment
  • Replies 3
  • Views 367
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

I have tried to add this code into a code block but nothing change.

Anyone here would have a solution for this.

I guess I'm not the only one having such issue...

thanks a lot in advance,

<script defer> document.querySelectorAll('#select-df09032e-2778-42e9-a51d-2b5488ebbada-field option')[1].setAttribute('value', "Informations de naissance"); document.querySelectorAll('#select-df09032e-2778-42e9-a51d-2b5488ebbada-field option')[2].setAttribute('value', "Lecture de mon DH"); document.querySelectorAll('#select-df09032e-2778-42e9-a51d-2b5488ebbada-field option')[3].setAttribute('value', "J'ai déjà eu une lecture de DH"); document.querySelectorAll('#select-df09032e-2778-42e9-a51d-2b5488ebbada-field option')[4].setAttribute('value', "Demande de Coaching"); document.querySelectorAll('#select-df09032e-2778-42e9-a51d-2b5488ebbada-field option')[5].setAttribute('value', "Pendule divinatoire"); document.querySelectorAll('#select-df09032e-2778-42e9-a51d-2b5488ebbada-field option')[6].setAttribute('value', "Une nouvelle économie est possible !"); document.querySelectorAll('#select-df09032e-2778-42e9-a51d-2b5488ebbada-field option')[7].setAttribute('value', "Autres"); </script>

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.