View Full Version : select onchange..

01-24-2008, 04:44 PM
Hello, I have problem with regards to select onchange.. heres the link


You see the dropdown box when I choose any from that dropdown this will display


if I click any letter below it will display the list of countries that start with the letter that I click.. e.g. letter P all countries that start with letter p will display

but If i click again the dropdown to select another currency.. the list of countries will go back to the first letter which is A.

Id like to be the list remaind in P unless it click another Letter..

heres my code..

<script type="text/javascript">
function reloads(form)
var val=form.cur_to.options[form.cur_to.options.selectedIndex].value;
self.location='index.php?option=com_content&task=view&id=13&Itemid=30&cur_to=' + val;
</script> // this for the reload form when clicking the dropdown

<select name="cur_to" onchange="reloads(form);">
echo "<option value='$rows[id]' selected>$rows[countryn]</option>";
echo "<option value='$rows[id]'>$rows[countryn]</option>";

</select>///this is the select box.

query code..

if(isset($_POST['cur_to']) || isset($_GET['cur_to']))
$query="select * from currency where id='$curid'";
else if(!isset($_POST['cur_to']))
$query="select * from currency where id='1'";

---------------array Letter----------------

<tr><td class="rc"></td>
$curid=($curid!='') ? $curid : 1;
<td colspan="2" align="center"><? foreach($letter as $key)

echo '<button id="Edit" onClick="self.location.href=\'?option=com_content&task=view&id=13&Itemid=30&cur_to='.$curid.'&country='.$key[$i].'\';" class="alpha" id="'.$key[$i].'" >'.$key[$i].'</button>';


anyone could help me.. thanks..

01-24-2008, 05:17 PM
anybody could help. thanksss

01-24-2008, 07:09 PM
You'll have to check if country has a value and pass that in your javascript since that's what you're doing the redirect with. You are not passing it into the query string if you look at your JS redirect.

01-28-2008, 10:19 AM
how to pass the value of the button to the js ..