Yii Framework Forum: Allow Rule For Dropdown Value... - Yii Framework Forum

Jump to content

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

Allow Rule For Dropdown Value... Rate Topic: -----

#1 User is offline   masdib.banget 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 63
  • Joined: 02-July 13

Posted 15 November 2013 - 03:42 AM

Sorry, I dont know yii in javascript.
Im make dropdownlist where value get for dynamic show and hidden form-field. Any clue..?
My View
<?php $cs = Yii::app()->getClientScript();
        $cs->registerScript('seleccion',
         'function seleccion(obj){
if(obj=="1"){
document.getElementById("attend").style.display="block";
document.getElementById("un-attend").style.display="none";
return false;
}
if(obj=="15"){
document.getElementById("attend").style.display="none";
document.getElementById("un-attend").style.display="block";
return false;
}
if(obj=="16"){
document.getElementById("attend").style.display="none";
document.getElementById("un-attend").style.display="block";
return false;
}
if(obj=="17"){
document.getElementById("attend").style.display="none";
document.getElementById("un-attend").style.display="block";

return false;
}
if(obj=="18"){
document.getElementById("attend").style.display="none";
document.getElementById("un-attend").style.display="block";

return false;
}
if(obj=="23"){
document.getElementById("attend").style.display="none";
document.getElementById("un-attend").style.display="block";

return false;
}
if(obj=="24"){
document.getElementById("attend").style.display="none";
document.getElementById("un-attend").style.display="block";

return false;
}
if(obj=="25"){
document.getElementById("attend").style.display="none";
document.getElementById("un-attend").style.display="block";

return false;
}
if(obj=="26"){
document.getElementById("attend").style.display="none";
document.getElementById("un-attend").style.display="block";

return false;
}
else{
document.getElementById("attend").style.display="none";
document.getElementById("un-attend").style.display="none";

return false;
}

}

',
         CClientScript::POS_END
        );
        ?>


<?php echo $form->dropDownListRow($model, 'id_status', CHtml::listData(Status::model()->findAll(array('condition'=>"t.set_trx_kemunculan = 2")), 'id', 'fullName'), array(
        'prompt'=>'Pilih Status','onchange'=>'return seleccion(this.value)')); ?>  


And my div Attend and un-attend is
<div id="attend" class="row" style="display:none"><?php echo $form->datepickerRow($model, 'tgl_selesai', array(
                    'class' => 'span20 input-inline',
                    'options' => array(
                        'format' => 'dd-mm-yyyy',
                        'autoclose' => true,
                        'language' => 'id',
                        'weekStart' => 1,
                    ),'prepend' => '<i class="icon-calendar"></i>')); 
        ?></div>


<div id="un-attend" class="row" style="display:none"><?php echo $form->datepickerRow($model, 'tgl_selesai', array(
                    'class' => 'span20 input-inline',
                    'disabled' => 'disabled', // 
                    'options' => array(
                        'format' => 'dd-mm-yyyy',
                        'autoclose' => true,
                        'language' => 'id',
                        'weekStart' => 1,
                    ),'prepend' => '<i class="icon-calendar"></i>')); 
        ?></div>


I want to make it disable if div attend show block, because its require in my model.
thanks advance
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