Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-21-2009, 08:54 AM   PM User | #1
appletree
New to the CF scene

 
Join Date: Mar 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
appletree is an unknown quantity at this point
Question select drop down ADDING a parameter to the GET url

I have a language drop down menu at the top of every page. The idea is you click the drop down, select your new language and the page reloads in that language. Works perfect. The only problem is if the page has OTHER parameters in its existing url. For example, if I'm at www.example.com/person?name=Scott and I try to change the language to en_US, I want the page www.example.com/person?name=Scott&language=en_US to be loaded. However, what actually happens is www.example.com/person?language=en_US is loaded . Here's my code:
Code:
<form action="/person?name=Scott" method="get">
  <select name="language" onchange="this.form.submit();">
    <option value="en_US" selected="selected">English (United States)</option>
    <option value="ro_RO">Romanian (Romania)</option>
  </select>
</form>
So my question is, is there an easy way to do what I want? Or do I have to insert <input type="hidden"> elements for each existing parameter in the url on each page?
appletree is offline   Reply With Quote
Old 03-21-2009, 02:39 PM   PM User | #2
timgolding
Senior Coder

 
timgolding's Avatar
 
Join Date: Aug 2006
Location: Southampton
Posts: 1,460
Thanks: 89
Thanked 110 Times in 109 Posts
timgolding is on a distinguished road
Thats annoying. Is there a reason you don't want to put the hidden elements in. Are you using php because if so you could write a script to generate the hidden elements something like

PHP Code:
<?PHP
foreach($_GET as $key => $value)
    echo 
'<input type="hidden" name="'.$key.'" value="'.$value.'">';
?>
__________________
You can not say you know how to do something, until you can teach it to someone else.
timgolding is offline   Reply With Quote
Old 03-21-2009, 11:25 PM   PM User | #3
appletree
New to the CF scene

 
Join Date: Mar 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
appletree is an unknown quantity at this point
Thanks timgolding, I was just hoping there was a simple flag I needed to set to enable what I wanted. I'm using Java/Spring, I'll just create those hidden elements.
appletree is offline   Reply With Quote
Reply

Bookmarks

Tags
form, parameters, select

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:19 PM.


Advertisement
Log in to turn off these ads.