Go Back   CodingForums.com > :: Client side development > JavaScript programming

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 12-28-2005, 10:36 AM   PM User | #1
marcus76
New to the CF scene

 
Join Date: Dec 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
marcus76 is an unknown quantity at this point
help with onChange="this.form.submit();"

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
}
?>

marcus76 is offline   Reply With Quote
Old 12-28-2005, 10:57 AM   PM User | #2
arne
Registered User

 
Join Date: Sep 2005
Posts: 315
Thanks: 0
Thanked 0 Times in 0 Posts
arne is an unknown quantity at this point
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.
arne is offline   Reply With Quote
Old 12-28-2005, 06:23 PM   PM User | #3
marcus76
New to the CF scene

 
Join Date: Dec 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
marcus76 is an unknown quantity at this point
Smile

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
marcus76 is offline   Reply With Quote
Old 12-29-2005, 01:53 AM   PM User | #4
firepages
Super Moderator


 
Join Date: May 2002
Location: Perth Australia
Posts: 3,890
Thanks: 5
Thanked 79 Times in 78 Posts
firepages will become famous soon enough
thats a javascript question so moving you there
__________________
resistance is...

MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)
firepages is offline   Reply With Quote
Old 12-29-2005, 09:10 AM   PM User | #5
Kor
Red Devil Mod


 
Kor's Avatar
 
Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 8,478
Thanks: 58
Thanked 379 Times in 375 Posts
Kor has a spectacular aura aboutKor has a spectacular aura about
onclick="document.forms['formname'].submit()"
__________________
KOR
Offshore programming
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Kor is offline   Reply With Quote
Reply

Bookmarks

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:52 AM.


Advertisement
Log in to turn off these ads.