Yii Framework Forum: Chosen Extension - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Chosen Extension Rate Topic: -----

#1 User is offline   Javed Iqbal 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 25-October 11

Posted 15 March 2014 - 12:43 PM

Hi
I have used Chosen extension for product dropdownlist. When I select value from dropdownlist and submit form and if there is validation issue on other inputs on the form then previous selected value from dropdownlist becomes unselected.

View

<?php /** @var BootActiveForm $form */
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
    'id'=>'verticalForm',
		'focus'=>array($model,'ptype'),
    'htmlOptions'=>array('class'=>'well'),
)); ?>
 
 <p class="note">Fields with <span class="required">*</span> are required.</p>
 <?php echo $form->errorSummary($model); ?>
<?php
$this->widget('ext.chosen.Chosen',array(
// 		'model'=> $model,
		'name' => 'inputName', // input name
		'value' => '', // selection
		'data' => CHtml::listData(ProductType::model()->findall("edt IS NULL"), 'id', 'product_type'),
));
<?php echo $form->textFieldRow($model, 'name', array('class'=>'span3')); ?>
<?php echo $form->textFieldRow($model, 'specifications', array('class'=>'span3')); ?>
<div class="form-actions">
		<?php $this->widget('bootstrap.widgets.TbButton', array(
			'buttonType'=>'submit',
			'type'=>'primary',
			'label'=>$model->isNewRecord ? 'Save' : 'Update',
		)); ?>
		<?php echo CHtml::link('<i class="icon-arrow-left"></i> Go Back',Yii::app()->request->urlReferrer,array('class'=>'btn'));?>
	</div> 

Javed Iqbal

Web Developer
syntecX Solution
skype:javedboqo
0

#2 User is offline   Javed Iqbal 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 25-October 11

Posted 16 March 2014 - 04:10 AM

View PostJaved Iqbal, on 15 March 2014 - 12:43 PM, said:

Hi
I have used Chosen extension for product dropdownlist. When I select value from dropdownlist and submit form and if there is validation issue on other inputs on the form then previous selected value from dropdownlist becomes unselected.

View

<?php /** @var BootActiveForm $form */
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
    'id'=>'verticalForm',
		'focus'=>array($model,'ptype'),
    'htmlOptions'=>array('class'=>'well'),
)); ?>
 
 <p class="note">Fields with <span class="required">*</span> are required.</p>
 <?php echo $form->errorSummary($model); ?>
<?php
$this->widget('ext.chosen.Chosen',array(
// 		'model'=> $model,
		'name' => 'inputName', // input name
		'value' => '', // selection
		'data' => CHtml::listData(ProductType::model()->findall("edt IS NULL"), 'id', 'product_type'),
));
<?php echo $form->textFieldRow($model, 'name', array('class'=>'span3')); ?>
<?php echo $form->textFieldRow($model, 'specifications', array('class'=>'span3')); ?>
<div class="form-actions">
		<?php $this->widget('bootstrap.widgets.TbButton', array(
			'buttonType'=>'submit',
			'type'=>'primary',
			'label'=>$model->isNewRecord ? 'Save' : 'Update',
		)); ?>
		<?php echo CHtml::link('<i class="icon-arrow-left"></i> Go Back',Yii::app()->request->urlReferrer,array('class'=>'btn'));?>
	</div> 




Finally I got solution
echo Chosen::activeDropDownList($model, "ptype", CHtml::listData(ProductType::model()->findall("edt IS NULL ORDER BY product_type"), 'id', 'product_type'), array());

Javed Iqbal

Web Developer
syntecX Solution
skype:javedboqo
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users