Welcome to WebmasterWorld Guest from 54.167.58.159

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

How to deal with HTML drop-down boxes after "Google Translate"?

     

jezzer300

3:23 pm on Jun 11, 2013 (gmt 0)

10+ Year Member



Hi,

I have a form at my checkout with a simple country selection box. e.g.:

"<select id="del_country" name="del_country"><option selected>Australia</option><option >Austria</option>..."

The selected country gets posted back to my PHP to decode the selection. This all works fine until a user visits my site using google translate. The selection is returned to me in the translated language, which is currently meaningless. What's a good way around this?

Although not completely ruled out, I'm trying to achieve this without using javascript.

Regards,

Jez.

rainborick

3:30 pm on Jun 11, 2013 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You should use the 'value' attribute in the <option> tag, as in:

<option value="Australia" selected>Australia</option>

The value attribute will not be translated by Google.

jezzer300

4:17 pm on Jun 11, 2013 (gmt 0)

10+ Year Member



Oh dear!

I've had the code in place for so long I completely missed value was missing. Thanks very much.