kartik-v / yii2-widget-depdrop

Widget that enables setting up dependent dropdowns with nested dependencies (sub repo split from yii2-widgets).
Other
81 stars 39 forks source link

The 'pluginOptions["url"]' property has not been set. #61

Closed liamgcarter closed 5 years ago

liamgcarter commented 6 years ago

Many thanks for all your widgets they are amazing

I was wondering if you could help me

Here is my view part 'contentBefore'=>'<legend class="text-info"><small>Client Info</small></legend>', 'attributes'=>[ // 2 column layout 'model'=>['type'=>Form::INPUT_DROPDOWN_LIST, 'items'=>ArrayHelper::map(\app\models\Models::find()->All(), 'id','name'), 'options'=>['prompt'=>'Please Select..','id'=>'model']], 'field'=>[ 'type'=>Form::INPUT_WIDGET, 'widgetClass'=>DepDrop::classname(), 'options' => ['id'=>'field'], 'pluginOptions' => [ 'depends' => ['model'], 'placeholder' => 'select ...', 'url' => 'http://google.co.uk' ], ], 'related_value'=>['type'=>Form::INPUT_TEXT, 'options'=>['placeholder'=>'Enter Value...']],

And the error throw out this

_form.php at line 49 – yii\base\Widget::widget(['model' => app\models\RelatedFields, 'form' => kartik\form\ActiveForm, 'autoGenerateColumns' => true, 'rows' => [['contentBefore' => '<small...', 'attributes' => ['model' => ['type' => 'dropdownList', 'items' => [1 => 'Clients', 2 => 'InvoiceItems', 3 => 'Invoices', 4 => 'Notes', ...], 'options' => ['prompt' => 'Please Select..', 'id' => 'model']], 'field' => ['type' => 'widget', 'widgetClass' => 'kartik\depdrop\DepDrop', 'options' => ['id' => 'field'], 'pluginOptions' => ['depends' => ['model'], 'placeholder' => 'select ...', 'url' => '/related-fields/dd-field']], 'related_value' => ['type' => 'textInput', 'options' => ['placeholder' => 'Enter Value...']]]], ['attributes' => ['actions' => ['type' => 'raw', 'value' => '<div style="text-align: right; m...']]]], ...])

as you can see the value is there

'pluginOptions' => ['depends' => ['model'], 'placeholder' => 'select ...', 'url' => '/related-fields/dd-field']

Any ideas?

liamgcarter commented 6 years ago

Hiya Sorry. I found the issue. As i am using FormGrid the pluginOptions and htmlOption needs to nest in another options array like this

'field'=>[ 'type'=>Form::INPUT_WIDGET, 'widgetClass'=>DepDrop::classname(), 'options' => [ 'options'=> ['id' => 'field'], 'pluginOptions' => [ 'depends' => ['model'], 'placeholder' => 'select ...', 'url' => '/related-fields/dd-field' ], ], ],

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.