yii-chtml

multi model forms in yii

倾然丶 夕夏残阳落幕 提交于 2019-12-17 22:34:31
问题 How to create a multi-model form in Yii? I searched the entire documentation of Yii, but got no interesting results. Can some one give me some direction or thoughts about that? Any help will be appreciable. 回答1: In my expirience i got this solution to work and quickly understandable You have two models for data you wish collect. Let's say Person and Vehicle . Step 1 : Set up controller for entering form In your controller create model objects: public function actionCreate() { $Person = new

CJuiDatePicker in CGridview as form field

落花浮王杯 提交于 2019-12-11 18:06:31
问题 I am displaying form elements in my CGridView and would like datepicker, but it complains CDataColumn and its behaviors do not have a method or closure named "widget". I have modified DATEIN using the method described in Use a widget in a statically-called method However i think it works partially as when i do a sort or the datepicker does not work. its working only on initial load. <script> $(document).ready(function() { /* $("input[name*='DATEIN'] ").each(function(){ jQuery(this).datepicker

Need listbox with multiple selection - in yii

别说谁变了你拦得住时间么 提交于 2019-12-10 20:35:58
问题 I need listbox of multiple selection in yii, i have code of form area but its saving to database as a word "Array" in field, How to handle this problem? how to get back while view and update and grid view also <?php echo $form->dropDownList($model,'clients', CHtml::listData(client::model()->findAll(array('order'=>'id')), 'id', 'name'), array('empty'=>'','multiple'=>'multiple','style'=>'width:400px;','size'=>'10')); ?> Thank you. 回答1: For me works this: 'multiple'=>true Your code must be

yii -> dropDownList -> CHtml::listData -> set selected value

爱⌒轻易说出口 提交于 2019-12-02 13:41:38
问题 How can I set the selected value in the following statement: echo $form->dropDownList( $model, 'land_id', CHtml::listData(ListeLand::model()->findAll(), 'iso', 'landname'), array('class'=>'span4 chosen','maxlength'=>20) ); I want to set in the list: iso = AT landname = Österreich as selected value. EDITED -> The solution: echo $form->dropDownList( $model, 'land_id', CHtml::listData(ListeLand::model()->findAll(), 'iso', 'landname'), array( 'class'=>'span4 chosen', 'maxlength'=>20, 'options' =>

yii -> dropDownList -> CHtml::listData -> set selected value

戏子无情 提交于 2019-12-02 04:30:34
How can I set the selected value in the following statement: echo $form->dropDownList( $model, 'land_id', CHtml::listData(ListeLand::model()->findAll(), 'iso', 'landname'), array('class'=>'span4 chosen','maxlength'=>20) ); I want to set in the list: iso = AT landname = Österreich as selected value. EDITED -> The solution: echo $form->dropDownList( $model, 'land_id', CHtml::listData(ListeLand::model()->findAll(), 'iso', 'landname'), array( 'class'=>'span4 chosen', 'maxlength'=>20, 'options' => array('AT'=>array('selected'=>true)), ) ); this works.. echo $form->dropDownList( $model, 'land_id',

multi model forms in yii

会有一股神秘感。 提交于 2019-11-28 17:58:15
How to create a multi-model form in Yii? I searched the entire documentation of Yii, but got no interesting results. Can some one give me some direction or thoughts about that? Any help will be appreciable. In my expirience i got this solution to work and quickly understandable You have two models for data you wish collect. Let's say Person and Vehicle . Step 1 : Set up controller for entering form In your controller create model objects: public function actionCreate() { $Person = new Person; $Vehicle = new Vehicle; //.. see step nr.3 $this->render('create',array( 'Person'=>$Person, 'Vehicle'=