标签:文本框
<?php$form=$this->beginWidget(‘CActiveForm‘,array(
????‘id‘=>‘contact-form‘,
????‘enableClientValidation‘=>true,
????‘clientOptions‘=>array(
????????‘validateOnSubmit‘=>true,
????),
)); ?>
显示全部错误:
?
1
<?phpecho$form->errorSummary($model); ?>
<?phpecho$form->labelEx($model,‘name‘); ?>//显示label
<?phpecho$form->textField($model,‘name‘,array(‘size‘=>60,‘maxlength‘=>128)); ?>//显示文本框
<?phpecho$form->textArea($model,‘body‘,array(‘rows‘=>6,‘cols‘=>50)); ?>//显示文本区域
<?phpecho$form->passwordField($model,‘password‘); ?>//显示密码框
<?phpecho$form->hiddenField($model,‘action‘,array(‘value‘=>‘add‘)); ?>//显示隐藏域
<?phpecho$form->textField($model,‘text‘,array(‘size‘=>60,‘maxlength‘=>128)); ?>//显示文本框
<?phpecho$form->passwordField($model,‘password‘); ?>//显示密码框
<?phpecho$form->fileField($model,‘file‘); ?>//显示上传域
<?phpecho$form->hiddenField($model,‘hidden‘,array(‘value‘=>‘add‘)); ?>//显示隐藏域
<?phpecho$form->dropDownList($model,‘select‘,array(‘A‘=>‘A‘,‘B‘=>‘B‘,‘C‘=>‘C‘)); ?>//显示下拉框
<?phpecho$form->listBox($model,‘select‘,array(‘A‘=>‘A‘,‘B‘=>‘B‘,‘C‘=>‘C‘),array(‘multiple‘=>‘multiple‘)); ?>//显示多选下拉框
<?phpecho$form->radioButton($model,‘radio‘,array(‘value‘=>‘A‘)); ?>A//显示一个radio
<?phpecho$form->radioButtonList($model,‘radio‘,array(‘A‘=>‘A‘,‘B‘=>‘B‘,‘C‘=>‘C‘)); ?>//显示多个radio
<?phpecho$form->checkBox($model,‘checkbox‘,array(‘value‘=>‘A‘)); ?>B//显示一个checkbox
<?phpecho$form->checkBoxList($model,‘checkbox‘,array(‘A‘=>‘A‘,‘B‘=>‘B‘,‘C‘=>‘C‘)); ?>//显示多个checkbox
<?phpecho$form->error($model,‘name‘); ?>//显示单个错误
<?phpechoCHtml::submitButton(‘Submit‘); ?>//submit
<?phpechoCHtml::imageButton(‘images/logo.png‘); ?>//image type submit
<?phpechoCHtml::resetButton(‘Reset‘); ?>//reset
<?phpechoCHtml::button(‘Button‘); ?>//button
<?phpechoCHtml::link(‘Q-blog‘,‘http://www.q-blog.cn‘); ?>//link
<?phpechoCHtml::image(‘images/logo.png‘); ?>//image
在最后要加上:
?
<?php$this->endWidget(); ?>
标签:文本框
原文地址:http://zhangzhichao.blog.51cto.com/11126669/1826917