Skip to content

Instantly share code, notes, and snippets.

@kirs
Created September 3, 2011 06:34
Show Gist options
  • Save kirs/1190734 to your computer and use it in GitHub Desktop.
Save kirs/1190734 to your computer and use it in GitHub Desktop.
CActiveForm example
<div class="b-form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'book-form',
'enableAjaxValidation'=>false,
)); ?>
<div class="b-form-row">
<?php echo $form->labelEx($model,'title', array('label'=>$model->getAttributeLabel('title').':')); ?>
<?php echo $form->textField($model,'title',array('maxlength'=>255)); ?>
<?php echo $form->error($model,'title'); ?>
</div>
<div class="b-form-row">
<?php echo $form->labelEx($model,'writer', array('label'=>$model->getAttributeLabel('writer').':')); ?>
<?php echo $form->textField($model,'writer',array('maxlength'=>255)); ?>
<?php echo $form->error($model,'writer'); ?>
</div>
<div class="b-form-row">
<?php echo $form->labelEx($model,'url', array('label'=>$model->getAttributeLabel('url').':')); ?>
<?php echo $form->textField($model,'url',array('maxlength'=>255)); ?>
<?php echo $form->error($model,'url'); ?>
</div>
<div class="b-form-row">
<?php echo $form->labelEx($model,'lang_id', array('label'=>$model->getAttributeLabel('lang_id').':')); ?>
<?php echo $form->dropDownList($model,'lang_id',Lookup::items('LanguageName')); ?>
</div>
<div class="b-form-row">
<?php echo $form->labelEx($model,'year', array('label'=>$model->getAttributeLabel('year').':')); ?>
<?php echo $form->textField($model,'year'); ?>
<?php echo $form->error($model,'year'); ?>
</div>
<div class="b-form-row">
<?php echo $form->labelEx($model,'about', array('label'=>$model->getAttributeLabel('about').':')); ?>
<?php echo $form->textField($model,'about',array('maxlength'=>255)); ?>
<?php echo $form->error($model,'about'); ?>
</div>
<div class="b-form-row">
<?php echo CHtml::submitButton($model->isNewRecord ? 'Создать' : 'Сохранить'); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment