There are 3 major steps for dealing with forms.
- Create model class.
- Create a Controller action.
- Create form.
There are two types of models.
- Form Model - With this we can collect, use and discard user input. (Eg : Login form)
- Active Record - With this we can collect user input and save them to the database.
Once model class is created, we should write code for the controller action to manipulate the model.
Create Form
Finally we create the form which contains HTML input fields. With Yii we can use helper classes to create forms.
Eg: CHtml::textField() - we can call this to create text input field.
CHtml::dropDownList() - we can call this to create drop down list.
No comments:
Post a Comment