|
|
|
 |
 |
 |
|
[ This topic is solved ]
|
|
Joao Correa
|
26 September 08 / 20:11 |
|
Changed at 26 September 08 / 20:13
Hi all,
Is possible to add a javascprit action for each option of radio group?
Example:
<?php
include( "FH3/class.FormHandler.php");
$form = new FormHandler();
$options = array(
1 => 'Option 1 '. JAVASCRIPT,'onClick(Do Something 1);',
2 => 'Option 2 '. JAVASCRIPT,'onClick(Do Something 2);'
);
$form->radioButton("Test", "test", $options);
$form->flush();
?>
|
|
|
|
Thomas Branius
|
29 September 08 / 12:36 |
|
Changed at 29 September 08 / 12:44
Hi,
a possible solution:
<?php
echo <<<END
<script language="javascript" type="text/javascript">
function test(obj)
{
switch(obj.id) {
case 'test_1' : Do Something 1; break;
case 'test_2' : Do Something 2; break;
}
}
</script>
END;
include( "FH3/class.FormHandler.php");
$form = new FormHandler();
$options = array(
1 => 'Option 1',
2 => 'Option 2'
);
$form->radioButton("Test", "test", $options, null, true, "onClick='test(this)'");
$form->flush();
?>
|
|
|
|
Joao Correa
|
29 September 08 / 15:10 |
|
| Thanks!! work fine!
|
|
|
|
|
|