Beispiel #1
0
         url: "index.php?r=reqdevice/showdevice&id=" +$(this).val(),
         data:{},
         //dataType: "json",
         contentType: "application/json; charset=utf-8",
         success: function(data) {
           $("#devicelist").html(data);
          },
         error: function(data){
            alert("fail");
         }
         });
', 'class' => 'form-control'])->label(false);
?>
    <label>รหัสอุปกรณ์</label>
    <?php 
echo $form->field($model, 'usdef2')->dropDownList(ArrayHelper::map($device->find()->all(), 'recid', 'assetname'), ['prompt' => 'เลือกอุปกรณ์', 'id' => 'devicelist'])->label(false);
?>
   
    
    <?php 
echo $form->field($model, 'comment')->textarea(['rows' => 6]);
?>
    <?php 
echo $form->field($model, 'isapprove')->checkbox();
?>
    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>
 /**
  * Finds the Reqdevice model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Reqdevice the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 public function actionShowdevice($id)
 {
     $count = Assets::find()->where(['assettypeid' => $id])->count();
     // $xx = $ass->find()->all();
     $val = Assets::find()->where(['assettypeid' => $id])->all();
     if ($count > 0) {
         foreach ($val as $data) {
             echo "<option value='" . $data->recid . "'>" . $data->assetname . "</option>";
         }
     } else {
         echo "<option> --- </option>";
     }
 }