CodeIgniter Forums
set_value() into form_multiselect - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forum-29.html)
+--- Thread: set_value() into form_multiselect (/thread-75900.html)



set_value() into form_multiselect - pbquet - 03-28-2020

Hello,
I use set_value() not only for input but also for select and multiselect in "form_dropdown" and "form_multiselect", and it worked well in CI3 :


PHP Code:
echo form_dropdown('id_user'$usersset_value('id_user'''));
echo 
form_multiselect('id_user[]'$users, (array)set_value('id_user''')); 

But with CI4 set_value return only string type, so it's no longer possible to use it for form_multiselect and their array value.


Do you think it would be possible to change the return type of set_value from "string" to "mixed" in order to make it possible again ?


PHP Code:
*
* @return 
string
*/
function 
set_value(string $fieldstring $default ''bool $html_escape true) : string 
will become in form_helper
PHP Code:
*
* @return 
mixed
*/
function 
set_value(string $fieldstring $default ''bool $html_escape true

thanks