Creating Forms In Yii Using Traditional Html

I want to use Foundation CSS Framework to create my forms, then use them in Yii and collect the input from the user. I generated a form using Gii form generator and the code looks like :

<?php echo $form->textField($model, ‘user_dob’); ?>

what I want to do is :

<input type="text" name="user_dob" value="" />

In the $form example, the value is assigned to the model when the form is submitted

while in the second, the values only get passed to the controller through POST but doesn’t get assigned to the model.

How can I do this ? I’m new to Yii

You will need to read The Guide in order to understand why Yii creates forms that way. One of the pages there covers Creating Form

Look at the source of the rendered page.

Name your input fields the same as the rendered output that Gii created.

For the value, do something like this:


<input type="text" id="user_dob" name="User[user_dob]" value="<?php echo $model->user_dob; ?>" />