<?php $form = $this->beginWidget('CActiveForm', array('id' => 'accounts-form', 'enableAjaxValidation' => true, 'focus' => array($model, 'code'))); ?> <p class="note">Fields with <span class="required">*</span> are required.</p> <?php echo $form->errorSummary($model); ?> <div class="row"> <?php echo $form->labelEx($model, 'category_id'); ?> <?php echo CHtml::dropDownList('Account[category_id]', $model->category_id, CHtml::listData(AccountCategory::model()->findAll(), 'id', 'name'), array('empty' => '(Select category) ')); ?> <?php echo $form->error($model, 'category_id'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'code'); ?> <?php echo $form->textField($model, 'code', array('size' => 20, 'maxlength' => 20)); ?> <?php echo $form->error($model, 'code');
<?php $this->breadcrumbs = array('Accounts' => array('index'), 'Manage'); $this->menu = array(array('label' => 'List Accounts', 'url' => array('index')), array('label' => 'Create Accounts', 'url' => array('create'))); Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('accounts-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n"); ?> <h1>Manage Accounts</h1> <p> You may optionally enter a comparison operator (<b><</b>, <b><=</b>, <b>></b>, <b>>=</b>, <b><></b> or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done. </p> <?php echo CHtml::link('Advanced Search', '#', array('class' => 'search-button')); ?> <div class="search-form" style="display:none"> <?php $this->renderPartial('_search', array('model' => $model)); ?> </div><!-- search-form --> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'accounts-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'code', 'htmlOptions' => array('width' => 100)), 'name', array('name' => 'category_id', 'filter' => CHtml::listData(AccountCategory::model()->findAll(), 'id', 'name'), 'value' => 'AccountCategory::model()->findByPk($data->category_id)->name'), array('class' => 'CButtonColumn'))));