dmstr / yii2-adminlte-asset

AdminLTE Asset Bundle for Backend Theme in Yii2 Framework
1.14k stars 425 forks source link

Modal form #194

Closed chrissy86 closed 4 years ago

chrissy86 commented 4 years ago

I have a form that is used to create customers order. Customer are pulled from the database. Want am trying to achieve is to have a link or button at the end of the dropdownlist used to create new customers. This form should be a modal.

After submitting the form, the newly created customer should be selected on the dropdown list.

I have the modal working but the modal button is outside the dropdownlist......i want it inside

Service

My deopdownlist

`<?= $form->field($model, 'ser_own_id', ['labelOptions'=>['class'=>'labelchange']])->widget(Select2::classname(),['data'=> ['newclient' => 'Add New'] + ArrayHelper::map(Owner::find()->all(),'owner_id','reg_no'),'language'=>'en', 'options'=>['placeholder'=>'Select Registration Number', 'id'=>'zipCode'], 'pluginOptions'=>[ 'allowClear'=>true ], ]); ?>

Url::to('index.php?r=owner/new'), 'class' => 'btn btn-success', 'id' => 'modalButton']);?> ` Modal form `'

Vehicle owner

', 'id' => 'modal', 'size' => 'modal-sm', ]); echo "
"; Modal::end(); ?>` Action used by modal to create new customers `public function actionNew() { $model = new Owner(); if ($model->load(Yii::$app->request->post()) && $model->save()) { //return $this->redirect(['view', 'id' => $model->owner_id]); echo 1; } else{ return $this->renderAjax('new', [ 'model' => $model, ]); } }`

schmunk42 commented 4 years ago

This repo contains just an asset-bundle, please ask your question here: https://forum.yiiframework.com/