Mutual influence selection and impact Selection

Source: Internet
Author: User

Mutual influence selection and impact Selection
Models

public function getLists($company_id = ''){$companye_model = Company::model()->findByPk($company_id);if($companye_model){$model = $this->model()->findAll(array('condition' => 'pid=:pid','params' => array(':pid'=>$companye_model->id),));}else{$model = $this->model()->findAll();}if(is_null($model))return  null;$data = array();foreach ($model as $key => $value) {$data[$value->id] = $value->name;}return $data;}
$ _ Form
<div class="row col-xs-8"><div class="col-xs-2"><?php echo $form->labelEx($model,'pid'); ?></div>        <div class="col-xs-9">        <?php echo CHtml::dropDownList('CompanyProduct[pid]','CompanyProduct[pid]', Company::model()->getLists(), array(            'class'=>'form-control',            'ajax'=>array(                'type'=>'GET',                'url'=>CController::createUrl('/companyProduct/getType'),                'update'=>'#CompanyProduct_typeid',                'data'=>array('mid'=>"js:this.value",'typeid'=>1)             ))        ); ?>        </div>    </div><div class="row col-xs-8"><div class="col-xs-2"><?php echo $form->labelEx($model,'typeid'); ?></div><div class="col-xs-9"><?php echo CHtml::activeDropDownList($model,'typeid',ProductType::model()->getLists(),array('class'=>'form-control')); ?><?php echo $form->error($model,'typeid'); ?></div></div>
Controller
public function actionGetType($mid){$results = ProductType::model()->getLists($mid);foreach ($results as $key => $value) {echo CHtml::tag('option', array('value'=>$key),CHtml::encode($value),true);# code...}}



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.