Form Generator
This generator generates a view script file that displays a form to collect input for the specified model class.
beginWidget('CCodeForm', array('model'=>$model)); ?>
labelEx($model,'model'); ?>
textField($model,'model', array('size'=>65)); ?>
Model class is case-sensitive. It can be either a class name (e.g. Post
)
or the path alias of the class file (e.g. application.models.LoginForm
).
Note that if the former, the class must be auto-loadable.
error($model,'model'); ?>
labelEx($model,'viewName'); ?>
textField($model,'viewName', array('size'=>65)); ?>
This refers to the name of the view script to be generated, for example,
site/contact
, user/login
. The actual view script file will be generated
under the View Path specified below.
error($model,'viewName'); ?>
labelEx($model,'viewPath'); ?>
textField($model,'viewPath', array('size'=>65)); ?>
This refers to the directory that the new view script file should be generated under.
It should be specified in the form of a path alias, for example, application.views
,
mymodule.views
.
error($model,'viewPath'); ?>
labelEx($model,'scenario'); ?>
textField($model,'scenario', array('size'=>65)); ?>
This refers to the scenario in which the model should be used to collect user input.
For example, a User
model can be used in both login
and register
scenarios.
To create a form for the login purpose, the scenario should be specified as login
.
Leave this empty if the model does not need to differentiate scenarios.
error($model,'scenario'); ?>
endWidget(); ?>