How to create form with editable ->addSelect(“category”, “Category:”)?
- Toanir
- Member | 57
The addSelect method creates instance of SelectBox. You should pass the selectable items as a third parameter in an associative array:
$form->addSelect("drink", "Favourite morning drink:", [
'tea' => 'Tea.',
'coffee' => 'COFFEEEEE!!!! !! !!!! !',
]);
Last edited by Toanir (2020-03-25 11:33)
- Takeshi
- Member | 596
Toanir wrote:
The addSelect method creates instance of SelectBox. You should pass the selectable items as a third parameter in an associative array:
$form->addSelect("drink", "Favourite morning drink:", [ 'tea' => 'Tea.', 'coffee' => 'COFFEEEEE!!!! !! !!!! !', ]);
OK, so please give me an example … your code doesnt contain an editable item
- Takeshi
- Member | 596
Toanir wrote:
I must have misunderstood your question so let's go back to the terminology. What is an ‘editable’? How should it behave?
At first, I am sorry for my english :-)
1. When I/we ceate a ->addSelect(), we put inside some data, array … and when it is rendered, I can choose one of them, but I can not write/type another text.
Last edited by Takeshi (2020-03-26 16:04)
- Marek Bartoš
- Nette Blogger | 1264
That's text input with datalist, not selectbox
https://caniuse.com/#…
- Takeshi
- Member | 596
Mabar wrote:
That's text input with datalist, not selectbox
https://caniuse.com/#…
Thank you for that,
can you give me an example? A cant reat it from your link. Thanks.
- Marek Bartoš
- Nette Blogger | 1264
Features at caniuse.com have tab “resources” where you can find
everything you need, e.g. https://hacks.mozilla.org/…html5-forms/
Just search for input with datalist, you may also want some JS implementation as
well, e.g. http://projects.sergiodinislopes.pt/flexdatalist/