2amigos / yii2-multi-select-widget

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

Empty array causes error #22

Open FiHoEco opened 4 years ago

FiHoEco commented 4 years ago

Multiselect::$data” attribute cannot be blank or an empty array. php is the error produced when given an empty array.

Could we instead have it so that nothing appears in the drop-down otherwise it massively limits our ability to use the widget without checking if it's empty first and then we don't have that form attribute available to use on submit (this was unexpected behaviour from the plugin since Select2 accepts an empty array). Many people won't have test cases for it if they're dynamically populating the drop-down and don't expect the array to ever return empty unless an edge case is hit.