Translated form elements are posted to webserver potentially causing error or unintended behaviour
Reported by
a7cp3ar...@gmail.com,
Nov 8
|
|||
Issue description
UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.20 Safari/537.36
Steps to reproduce the problem:
1. Go to a site that has a form with a <select> and pre-defined <options>. A simple example is a list of country names all in the same language:
<select name="country" required>
<option disabled>Please Select a Country</option>
<option>Australia</option>
<option>Germany</option>
<option selected="selected">United Kingdom</option>
<option>United States</option>
</select>
'more-correct' markup:
<select name="country" required>
<option disabled>Please Select a Country</option>
<option value="Australia">Australia</option>
<option value="Germany">Germany</option>
<option selected="selected" value="United Kingdom">United Kingdom</option>
<option value="United States">United States</option>
</select>
2. I tested with an English base site, German as the translation language (Right click, Translate page to English, Options, Change languages, Translate this page to: German)
3. Some or all of the country names will have been translated in the slect: e.g. Austria -> Österreich. For some reason not all of them are consistently translated for me.
<option>
<font style="vertical-align: inherit;"><font style="vertical-align: inherit;">Österreich</font></font>
</option>
correct markup:
<option value="Austria">
<font style="vertical-align: inherit;"><font style="vertical-align: inherit;">Österreich</font></font>
</option>
4. Now if you submit a form with the select with no value attrs, the browser will send the translated option text off to the server as the value is assumed to be the character data in the option if no value is explicitly given as an attribute. This results in the server receiving the form data with a translated country name.
What is the expected behavior?
With both you would expect that the value seen by the server would be the untranslated option value.
When translating <selects> that have no value attr, these should probably be added with the original text.
What went wrong?
If using the <select> with no value attributes, the browser displays the translated text to the user, and also posts this translated text.
This results in the server rejecting the form as the country name is now not part of the original list, leading to unintended behaviour that'd depend on how the server decides to handle the request.
With the (recommended/required, not sure which) explicit value="..." added to options, the form submits fine.
Did this work before? N/A
Chrome version: 70.0 Channel: n/a
OS Version: 7
Flash Version:
,
Nov 14
Please provide a sample html testcase for further triaging.
,
Dec 17
No feedback was received in the last 30 days from the reporter, so archiving this issue. Please re-open or file a new bug if necessary. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot |
|||
►
Sign in to add a comment |
|||
Comment 1 by vamshi.kommuri@chromium.org
, Nov 8