don.vijay05
(don.vijay05@gmail.com)
August 9, 2014, 6:37am
1
hello friends.
In my form I have a attribute called type. that contain 1.theory 2.practical 3.tutorial.
these three options are in check box. I need to save it in to the db.
The problem is if the datatype for the "type" attribute is int means its saves as 1. If the datatype varchar means it saves as "Array". how can i save it. am in a bottleneck. plz help me out
this is my _form.php
<?php
$chk = CHtml::activeCheckBoxList($model,'type',CHtml::listData(Subjecttype::model()->findAll(), 'subjectType', 's_id'),
array(
'separator'=>'',
'template'=>'<div>{input} {label}</div>'
)
);
echo $chk;
?>
what ill i do after this ? thank you…
frienddebu
(D C Urfriend)
August 9, 2014, 6:58am
2
Why you dont use this :
<div class="row">
<?php echo $form->labelEx($model,'theory '); ?>
<?php echo $form->checkBox($model,'user_type',array('value'=>'theory ','size'=>10,'maxlength'=>10)); ?>
<?php echo $form->error($model,'user_type'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'practical '); ?>
<?php echo $form->checkBox($model,'user_type',array('value'=>'practical ','size'=>10,'maxlength'=>10)); ?>
<?php echo $form->error($model,'user_type'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'tutorial'); ?>
<?php echo $form->checkBox($model,'user_type',array('value'=>'tutorial','size'=>10,'maxlength'=>10)); ?>
<?php echo $form->error($model,'user_type'); ?>
</div>
don.vijay05
(don.vijay05@gmail.com)
August 9, 2014, 9:31am
3
Why you dont use this :
<div class="row">
<?php echo $form->labelEx($model,'theory '); ?>
<?php echo $form->checkBox($model,'user_type',array('value'=>'theory ','size'=>10,'maxlength'=>10)); ?>
<?php echo $form->error($model,'user_type'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'practical '); ?>
<?php echo $form->checkBox($model,'user_type',array('value'=>'practical ','size'=>10,'maxlength'=>10)); ?>
<?php echo $form->error($model,'user_type'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'tutorial'); ?>
<?php echo $form->checkBox($model,'user_type',array('value'=>'tutorial','size'=>10,'maxlength'=>10)); ?>
<?php echo $form->error($model,'user_type'); ?>
</div>
Thank you for you response
As am using this, If am selected the theory and the practical means in my db this will not saved as "theory,practical" in the type column. I need to save like this
@Debasis