Click here to Skip to main content
15,913,773 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everyone!

I used the Codeigniter (i18n) library to internationalization my site.
I wanna make a view file with a dropdown list with languages like this.
The user can select a language.
How can i set language with the main controller by the selected element value.
(How to add the url the selected element’s value like this “http://localhost/multilang/de”)

I have an Ajax.js with i can get the selected elemenet, and i can send it to controller by post.
XML
<select>
  <option value="en">English</option>
  <option value="fr">French</option>
  <option value="hu">Hungarian</option>
  <option value="ro">Romanian</option>
</select>
( I am sorry for my bad English.)
Posted
Updated 30-Jun-12 1:08am
v2

1 solution

HTML
<select>
  <option value="en">English</option>
  <option value="fr" SELECTED>French</option><!--this will be selected-->
  <option value="hu">Hungarian</option>
  <option value="ro">Romanian</option>
</select>


if you want to change selected value using javascript the the code is simple:
JavaScript
document.getElementById('SelectObjectId').value='hu';
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900