יום שישי, 12 ביולי 2013

Add simple form in YII

The form declaration

  1: <?php
  2: /* @var $this SiteController */
  3: /* @var $model ContactForm */
  4: /* @var $form CActiveForm */
  5: 
  6: $this->pageTitle=Yii::app()->name . ' - Contact Us';
  7: $this->breadcrumbs=array(
  8:   'Contact',
  9: );
 10: ?>
 11: <h1>Operators</h1>
 12: 
 13: <div class="form">
 14: <?php $form=$this->beginWidget('CActiveForm', array(
 15:   'id'=>'login-form',
 16:   'enableClientValidation'=>true,
 17:   'clientOptions'=>array(
 18:     'validateOnSubmit'=>true,
 19:   ),
 20: )); ?>
 21:   
 22:   
 23:   <div class="row">
 24:     <?php echo $form->labelEx($model,'Search for:'); ?>
 25:     <?php echo $form->textField($model,'Name'); ?>
 26:     
 27:   </div>
 28:   
 29:   <div class="row buttons">
 30:     <?php echo CHtml::submitButton('Start Search'); ?>
 31:   </div>
 32: 
 33: <?php $this->endWidget(); ?>
 34: </div><!-- form -->
 35: 

The modal


  1: <?php
  2: class OperatorModel extends CFormModel
  3: {
  4:   function __construct() {
  5:        parent::__construct();     
  6:    }
  7:    
  8:    public $Name;
  9: }
 10: ?>
 11: 

The result
Capture50

אין תגובות:

הוסף רשומת תגובה