Reputation: 115
i have a problem with the checkbox field that does not save me the data in the database . In the database I have the ' conditions ' field ( chekbox field ) as boolean . when sending the form I do not save as checked ( 1 ) .
my model Rules
return[
'condizioniRequired' => ['conditions','required'],
'condizioniType' => ['conditions','boolean'],];
My view
<?= $form->field($model, 'conditions')->checkbox(array('label'=>'Offerted')); ?>
all other fields are saved.
Upvotes: 0
Views: 1366
Reputation: 1036
You have to do like this :
<?= $form->field($model, 'conditions')->checkBox(['uncheck' => '0', 'checked' => '1'])->label('label'=>'Offerted') ?>
I hope this will help!!.
Upvotes: 1