Tuesday, September 30, 2008

javascipt onclick in $html->image

hey all,

This is really bugging me and i'm sure it's something that i'm not
doing.

my code is:

$id = $module['Module']['id'];
echo $form->input($module['Module']['refer_name'],
array(
'label'=>$module['Module']['title'].$html->image('1/
question.gif',
array(
'class'=>'question',
'onclick'=>'open_win($id)'
)),
'type'=>'checkbox',
'value'=>$module['Module']['price'],
'onclick'=>'addValue(this)'
));

This issue is with the onclick => open_win($id). it is not being
passed correctly. I have tried various combinations and they are as
follows:
(the code works fine if i pass a number through: open_win(1))

In this example, $id is equal to 2.


$id = blank, i.e it is defined but as blank
'$id' = error (unexpected T_VARIABLE)
"$id" = $id (not the value)
<?php echo $id; ?> = blank, i.e. it is defined but as blank
'<?php echo $id; ?>' = error (unexpected '?')
"<?php echo $id;?>" = <?php echo $id;?> not the value

Has anyone come across this before or has anyone got some pointers?

Cheers

alex
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: