Yii Framework Forum: Yii Method To Disable Selected Options From Multi Select Dropdown - Yii Framework Forum

Jump to content

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

Yii Method To Disable Selected Options From Multi Select Dropdown yii method to disable selected options from multi select dropdown Rate Topic: -----

#1 User is offline   anil.dhiman 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 27
  • Joined: 02-February 12
  • Location:india

Posted 17 May 2013 - 03:36 AM

I am using yii dropdown with active records in that i am using multiselect dropdown. i am creating data with in which i am selected multiple option from dropdown.. while updating i want to disable selected option which i selected at time of creation.

<code>
<?php
$savedSections = helpers::getQuestionnaireSectionList($model->questionnaire_id);

$data = helpers::getSection();

$listData = CHtml::listData($data, 'section_id', 'section_name');

$htmlOptions = array('size' => '5', 'multiple' => 'true','style'=>'width: 333px');

$queSection->section_ref_id = $savedSections; #sec2

echo $form->listBox($queSection,'section_ref_id',$listData, $htmlOptions); #sec1

?>

<code>

now here #sec1 is showing output with multiple option and i am also getting selected options but i want to disabled all the selected option which is coming from #sec2

Please help me if you have any idea.

regards anil
Thanks & Regards
Anil Kumar
Yii | Wordpress Professional
Skype : anildhiman3
Moodycoder.com
Free online reading books portal
0

#2 User is offline   ashish patel 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 20-February 13

Posted 17 May 2013 - 08:46 AM

hi guys,
Same like following code you have to do--

<div class="input_Slide">
<?php echo $form->labelEx($modelArticle,'enabled_version'); ?>
<div class="vers">
<?php
if($modelArticle->isNewRecord){
echo $form->dropDownList($modelArticle,'enabled_version[]',$version_list,array('multiple'=>true,'readonly'=>true));
}else{ ?>
<select id="versions" name="enabled_version[]" class="dropdown" multiple="multiple">
<?php
$i=0;
foreach ($version_list as $item=>$val) : ?>
<option
<?php if(in_array($item, $versions)){echo 'selected="selected" '; } ?>
value="<?php echo $item ?>"><?php echo $val ?></option>
<?php endforeach ?>
</select>
<?php } ?>
</div>
<?php echo $form->error($modelArticle,'enabled_version'); ?>
</div>

View Postanil.dhiman, on 17 May 2013 - 03:36 AM, said:

I am using yii dropdown with active records in that i am using multiselect dropdown. i am creating data with in which i am selected multiple option from dropdown.. while updating i want to disable selected option which i selected at time of creation.

<code>
<?php
$savedSections = helpers::getQuestionnaireSectionList($model->questionnaire_id);

$data = helpers::getSection();

$listData = CHtml::listData($data, 'section_id', 'section_name');

$htmlOptions = array('size' => '5', 'multiple' => 'true','style'=>'width: 333px');

$queSection->section_ref_id = $savedSections; #sec2

echo $form->listBox($queSection,'section_ref_id',$listData, $htmlOptions); #sec1

?>

<code>

now here #sec1 is showing output with multiple option and i am also getting selected options but i want to disabled all the selected option which is coming from #sec2

Please help me if you have any idea.

regards anil

0

#3 User is offline   epulgaron 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 59
  • Joined: 19-February 14

Posted 25 June 2014 - 09:54 AM

I have tried to use this extension, but I several problems arise
1-not the dropdown closes when I choose an item
2-close button does not work me
3-when I give "insert" an element over my application throws me the error "field must be a number", the primary keys are integers and auto-increment

any idea?
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