Yii Framework Forum: Dropdowns - Yii Framework Forum

Jump to content

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

Dropdowns Rate Topic: -----

#1 User is offline   vishnuvarthan 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 22-February 13
  • Location:India

Posted 21 March 2013 - 10:50 AM

SCRIPT for DROPDOWN:

Yii::app()->clientScript->registerScript('filter', "
	
	$('#filter_form').submit(function(event) {
	event.preventDefault();
	$('#HiflashQuotation_project_id').change();
	});
	
    $('#HiflashQuotation_project_id').change(function(event){
		var project = $('#HiflashQuotation_project_id').val();
                
		var form = $('#filter_form');
		var msg = '';
		if(project!='')
		{
		  var a = $(this).attr('HiflashQuotation_project_id');
                  var fields = $('#HiflashQuotation_project_id').attr('field');
                  alert(fields);
                  var results = 'projectname' + a;
                  $('#' + results).text('new results');
                  msg='project';
		}
        
		if(msg=='Select Projects')
		{
            
			$.fn.yiiGridView.update('quotation-grid', {
		          data: $(this).serialize()
            });
	               return false;
			
		}
        
		else
		{
            
			$.fn.yiiGridView.update('quotation-grid', 
					{
						type:'GET', 
						url:'".Yii::app()->createUrl('HiflashQuotation/admin')."', 
						data: form.serialize()
                        
                     
					}); 
			return false;
		}
		});
    ",CClientScript::POS_READY);


DROPDOWN :

<form id="filter_form" onsubmit="return false;"> 
<?php echo CHtml::DropDownList('HiflashQuotation[project_id]', '', CHtml::listData(HiflashProjects::model()->findAll(), 'id', 'project_name'), array('empty'=>'Select Projects','style'=>'width:150px;'), array(array('class' => 'myDropDown'))); ?>
        <div id="projectname">
        </div>
        </form>

Attached File(s)

  • Attached File  name.JPG (100.62K)
    Number of downloads: 16

0

#2 User is offline   agetakka 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 16-February 14

Posted 13 June 2014 - 06:14 AM

can you show me step by step to use dropdownlist which use data from database?
thanks
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