yii表单

<?php
/* @var $this LijunController */
/* @var $model Lijun */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'lijun-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>
	<?php // 输入文本框 ?>
	<div class="row">
		<?php echo $form->labelEx($model,'标题'); ?>
		<?php echo $form->textField($model,'title',array('size'=>60,'maxlength'=>200)); ?>
		<?php echo $form->error($model,'title'); ?>
	</div>
	<?php // 文本输入 ?>
	<div class="row">
		<?php echo $form->labelEx($model,'内容'); ?>
		<?php echo $form->textArea($model,'content',array('rows'=>6, 'cols'=>53)); ?>
		<?php echo $form->error($model,'content'); ?>
	</div>
	<?php // 单选按钮 ?>
	<div class="row">
		<?php echo $form->labelEx($model,'是否发布'); ?>
		<?php echo $form->radioButtonList($model, 'ispub', 
										array('1'=>'已发布', '0'=>'未发布'), 
										array('template' => '<li style="display:inline-block;width:25px;">{input}</li><li style="display:inline-block;width:50px;">{label}</li>', 'separator' => '')); ?>  
		<?php echo $form->error($model,'ispub'); ?>
	</div>
	<?php // 日期输入框 ?>
	<div class="row">
		<?php echo $form->labelEx($model,'发布日期'); ?>
		<?php echo $form->dateField($model,'pubdate'); ?>
		<?php echo $form->error($model,'pubdate'); ?>
	</div>
	<?php // 复选输入框 ?>
	<div class="row">
		<?php echo $form->labelEx($model,'新闻类型'); ?>
				<?php echo $form->checkBoxList($model, 'newstype', 
										array('财经新闻'=>'财经新闻', '体育新闻'=>'体育新闻', '国际新闻'=>'国际新闻', '房产新闻'=>'房产新闻'), 
										array('template' => '<li style="display:inline-block;width:25px;">{input}</li><li style="display:inline-block;width:70px;">{label}</li>', 'separator' => '')); ?>  
		<?php echo $form->error($model,'newstype'); ?>
	</div>
	<?php // 输入文本框 ?>
	<div class="row">
		<?php echo $form->labelEx($model,'新闻类别'); ?>
		<?php echo $form->dropDownList($model,'newslevel',array('苹果'=>'苹果','香蕉'=>'香蕉','桔子'=>'桔子','菠萝'=>'菠萝','榴莲'=>'榴莲')); ?>
		<?php echo $form->error($model,'newslevel'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? '创建' : '保存'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->

相关推荐