...

View Full Version : help with onChange="this.form.submit();"



marcus76
12-28-2005, 11:36 AM
hi,
I have the following piece of php code to change my default currency. I would ideally like to have the images as hyperlinks which upon clicking would change the currency rather than having to select from the drop down. Can someone please advise the best way to do this?

Many thanks

Marcus


<?php

if (isset($currencies) && is_object($currencies)) {
?>
<!-- currencies //-->
<tr>
<td>

<?php
$info_box_contents = array();
$info_box_contents[] = array('text' => BOX_HEADING_CURRENCIES);

new CurrenciesBoxHeading($info_box_contents, false, false);

reset($currencies->currencies);
$currencies_array = array();
while (list($key, $value) = each($currencies->currencies)) {
$currencies_array[] = array('id' => $key, 'text' => $value['title']);
}

$hidden_get_variables = '';
reset($HTTP_GET_VARS);
while (list($key, $value) = each($HTTP_GET_VARS)) {
if ( ($key!= 'currency') && ($key!= tep_session_name()) && ($key!= 'x') && ($key!= 'y') ) {
$hidden_get_variables .= tep_draw_hidden_field($key, $value);
}
}

$info_box_contents = array();
$info_box_contents[] = array('form' => tep_draw_form('currencies', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get'),
'align' => 'center',
'text' => tep_image(DIR_WS_IMAGES . 'flag_uk_curr.jpg') . tep_image(DIR_WS_IMAGES . 'flag_euro_curr.jpg') . tep_draw_pull_down_menu('currency', $currencies_array, $currency, 'onChange="this.form.submit();" style="width: 100%"') . $hidden_get_variables . tep_hide_session_id());

new CurrenciesBox($info_box_contents);

?> </td>
</tr>
<!-- currencies_eof //-->
<?php
}
?>

:thumbsup:

arne
12-28-2005, 11:57 AM
Maybe by using ONCLICK with the images?
And if you want to put a value to it you might to it by making a form with hidden types.

marcus76
12-28-2005, 07:23 PM
thanks for the reply. Can someone please give me a clue to the onclick syntax which would give the desired effect. Sample code would be great for me to work with.

appreciate your help

Regards

Marcus

firepages
12-29-2005, 02:53 AM
thats a javascript question so moving you there

Kor
12-29-2005, 10:10 AM
onclick="document.forms['formname'].submit()"



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum