i need to put a checkbox in _form file of a model class.if there is a particular column in database table related to checkbox,it is appearing on the form.but i dont want to put any column for this checkbox in my database table.Also i need to put an onClick event for that checkbox.
i am using this code…
<div id="row">
<?php $form->labelEx($model,‘test’);
<?php $form->checkBox($model,‘test’);
<?php $form->error($model,‘test’);
</div>
this code gives an error "test" is not defined.if there is no column in database table for this checkbox
As you say, you dont need a database column, so you can use CHtml::[font=monospace]checkBox there you can put name which you wannt it’s not debend on your model becaus it is not asociated with model, if you chose CHtml::activeC[/font][font=monospace]heckBox then you must use your model and with simple [/font][font=monospace]checkBox it dont need to be used.[/font]