![]() |
Hi all,
Does anyone know is there is a way to place additional attributes to the option tag in a Select dropdown, using the form_dropdown() form helper? I am trying to achieve a out put like this Code: <select class="floating-select" name="tam_day_label" id="tam_day_label" onclick="this.setAttribute(\'value\', this.value);" value=" " required/> my current form dropdown (select) is compiled like below: Controller PHP Code: $dayArray=[ PHP Code: <?= form_dropdown('tam_day_label', $dayArray, old('tam_day_label'), $dayType_tags); ?> Output Code: <select class="floating-select" name="tam_day_label" id="tam_day_label" onclick="this.setAttribute(\'value\', this.value);" value=" " required/> Many thanks.
The easiest way to know is looking at the code: https://github.com/codeigniter4/CodeIgni...r.php#L267
The short answer: it's not possible. Anyway, I'm not sure how it could be implemented since it takes a simple key/value array as input for the options.
Thank you includebeer.
I toyed with this for quite a while, obviously with no luck and thought I was missing something. I will have to take a different approach, but isn't that half the fun? Again, many thanks |
Welcome Guest, Not a member yet? Register Sign In |