0

Hello,

I have used for loop to create checkboxes.
and on each of them i want to know its checked or unchecked.
code is as below:

foreach ($All_skill_type as $All_skill_type_)
                    {
                        $each_skill_type=$All_skill_type_ -> skill_type ;
                        // find skill_type_id and serach Skills for that skill_type
                        $skill_type_id=helpers::getSkillTypeId($each_skill_type);
                        $skills_of_skill_type=helpers::getskills($skill_type_id);
?>
                        <fieldset class="step">
                            <p>
                                <label style='width:170px!important;'><? echo $each_skill_type .":";?></label>
                                <br><br>
                                <?
                                    for ($i=0;$i<sizeof($skills_of_skill_type);$i++)
                                    {
                                        $skill_box=$skills_of_skill_type[$i]['skill'];
                                        echo CHtml::CheckBox($skill_box,'', array (
                                        //'id'=>'used_in_gs',
                                        "onclick"=>"js:skill_check('".$skill_box."','".$each_skill_type."')",
                                        ));
                                        echo CHtml::label($skill_box, $skill_box);
                                    }
                                ?>
                            </p>
                        </fieldset>
<?
                    }

Above code is written in Yii framwork.

Now onclick of each checkbox, an calling function skill_check(),
but how to recognize whether the checkbox is checked or unchecked?

1
Contributor
1
Reply
7
Views
3 Years
Discussion Span
Last Post by Priti_P
1

Hello,
Solved it.
I put uniq id for each checkbox.

'id'=>'skill_used'.$skill_id,
$skill_id is unique here.
and passed it in function also.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.