manhooei
(Alex Coner)
1
In my database, I have a date of birth (dob) field that is of type date.
When I create model from my table, it creates one attribute as dob for
me.
So when I generate my form from my model, it has one field that can collect
the user’s date of birth. What I want to have is to have 3 dropdown elements
each for day month and year. then when I submit my form, they all get bundle
up together as dd-mm-yyyy and get populated to my model attribute "dob"
At this point I can’t figure out how to do it using Yii form since the model
gets passed to the view, how can I find a way to accomplish this. So to recap,
-I want to have only one field in my User table for dob as date type
-I want to have 3 dropdowns in my Yii generated form that at submit time they
form my dob and populate it in the $model->user_dob
why dont you try date picker instead that heavy hard coding…
<div class="row">
<?php echo $form->labelEx($model,'end'); ?>
<?php //echo $form->textField($model,'end'); ?>
<?php
$this->widget('zii.widgets.jui.CJuiDatePicker', array(
'name'=>'end',
'model'=>$model,
'attribute'=>'end',
// additional javascript options for the date picker plugin
'options'=>array(
'showAnim'=>'fold',
'dateFormat'=>'dd-mm-yy'
),
'htmlOptions'=>array(
'style'=>'height:20px;'
),
));
?>
<?php echo $form->error($model,'end'); ?>
</div>
–hope this helps
manhooei
(Alex Coner)
3
Yes I think that is the better way to accomplish what I want. Appreciate it Buddy! 