ask::check box with javascript

hello everyone .

i have three checkbox and i trying to show text area when checkbox checked

i dont know where to put an oncheck function

my code is

<?php echo $form->labelEx($model,'kondisi'); ?>

		<?php echo $form->radioButtonList($model,'kondisi',array('BAIK'=>'Baik','RUSAK_RINGAN'=>'Rusak Ringan','RUSAK_BERAT'=>'Rusak Berat'),array(

			'template'=>'<span id= "checkid" class="sradio" onclick="check(this)">{input} {label} </span>',

			'separator'=>' ',



			)); ?>

need your help

regards kay.

You needn’t to give js function as htmloption.

you can write javascript anywhere in view file like:

<script type="text/javascript">


      //write action here



or create .js file and connect it with view file.

i`m sory but yes i need more specified to put the onclick action i had tried my code but onCLick not working

here the java script i ues

function check(ctrl)


	//get the state of the check box

	if (ctrl.checked == true) {


		document.all['moreInfo'].style.display = "inline";

	} else {


		document.all['moreInfo'].style.display = "none";



this the table that contain the id of java script call

<table border="0" id="moreInfo" style="display:none">


<td>Something here</td>



but its not working . where am wrong ?

don’t use document.all as a selector

use document.getElementById(id);

function check(ctrl)


        //have you tried with alert ?


        //get the state of the check box

        if (ctrl.checked == true) {


                document.all['moreInfo'].style.display = "inline";  //use document.getElementById(id);

        } else {


                document.all['moreInfo'].style.display = "none";



i good it working now .i use this javascript

<style type="text/css"> 

#div1, #div2, #div3 


DISPLAY: none; 



<script type="text/javascript"> 

function Toggle(thediv) { 

document.getElementById("div1").style.display = "none"; 

document.getElementById("div2").style.display = "none"; 

document.getElementById("div3").style.display = "none"; 

document.getElementById(thediv).style.display = "block"; 




<input type="radio" name="Toggledivs"   />Turn on div 1<br />

<input type="radio" name="Toggledivs" onclick="Toggle('div2');" />Turn on div 2<br />

<input type="radio" name="Toggledivs" onclick="Toggle('div3');" />Turn on div 3<br />

<br /><br /> 

<div id="div1">I am the content of div 1</div> 

<div id="div2">I am the content of div 2</div> 

<div id="div3">I am the content of div 3</div> 


thanks you for your help :)