jQuery change form action based on selected value
<p>ive run into a quite tricky problem while using a method to set the form action when value changes. I have got the following code :</p>

<pre><code>var actions = new Array();
actions[0] = "some-site.html";
actions[1] = "some-other-site.html";
actions[2] = "another-site.html";
etc....

$("select#feld-urlaubsart").change(function () {
if ($("select#fieldname").val() !== "") {
$("form#searchform").attr("action","http://www.mysite.com/" +  
actions[$("select#fieldname").val()]);
}
});
</code></pre>

<p>On the other side, my select looks like this :</p>

<pre><code>&lt;select id="fieldname" name="fieldname"&gt;
&lt;option value="0" selected="selected"&gt;All&lt;/option&gt;
&lt;optgroup label="Golfurlaub mit Greenfees"&gt;
&lt;option value="1"&gt;Alle Greenfee-Angebote&lt;/option&gt;
&lt;option value="2"&gt;Top-Angebote&lt;/option&gt;
&lt;option value="3"&gt;Golfurlaub mit 4 Tage Greenfee&lt;/option&gt;
&lt;/optgroup&gt;
</code></pre>

<p>Actually it does work but i am not happy with it as i need to rely on the value="1" value="2" etc.</p>

<p>Now i need to use the actual description as value to be compatible with another script that i pass the value to for usage in PHP/JSON. I would need the data like this</p>

<pre><code>&lt;option value="All"&gt;All&lt;/option&gt;
&lt;option value="Option 1"&gt;Option 1&lt;/option&gt;
etc
</code></pre>

<p>How can i change the action of the form based on the selected VALUE while not needing to use array keys like "1" "2" etc?</p>

<p>Thanks for any advice.</p>
