2amigos / yii2-multi-select-widget

Bootstrap MultiSelect and MultiSelect Listbox widgets for Yii2
https://2amigos.us
Other
45 stars 29 forks source link

on submit, an extra blank value is being passed #12

Open gunnrryy opened 7 years ago

gunnrryy commented 7 years ago

Hi, its a question, not an actual issue. but in my case no. of fields being too many it makes an issue for me to cutdown the not-required things from my url.

<?= $form->field($model, 'product_type_id')->dropDownList(ArrayHelper::map(ProductTypes::find()->all(), 'id', 'name'), ['multiple' => true]); ?> the dropdown with multi-select is generated properly and working fine. but when submitted,

the query params being generated are like below

myForm%5Bproduct_type_id%5D=&myForm%5Bproduct_type_id%5D%5B%5D=1&myForm%5Bproduct_type_id%5D%5B%5D=2

url decoded as myForm[product_type_id]=&myForm[product_type_id][]=1&myForm[product_type_id][]=2

the first myForm[fieldName]=& the desired outcome? just curious to know. though it doesn't have any issue, as the later part over-writes the 1st blank. has anyone else noticed this ?