Replies: 1 comment 1 reply
-
Try this: <?php
use Phalcon\Html\Escaper;
use Phalcon\Html\Helper\Input\Select;
$escaper = new Escaper();
$helper = new Select($escaper);
$options = [
'id' => 'carsList',
'multiple' => 'multiple', // <--- HERE
];
$result = $helper(' ', PHP_EOL, $options);
$result
->add("Ferrari", "1", ["class" => "active"])
->add("Ford", "2")
->add("Dodge", "3")
->add("Toyota", "4")
->optGroup(
'oneLabel',
[
'class' => 'form-input',
]
)
->addPlaceholder(
'Choose & Car...',
"0",
[],
true,
)
->selected("3")
;
echo $result;
//
// <select id="carsList" multiple="multiple">
// <optgroup class="form-input" label="oneLabel">
// <option value="0">Choose & Car...</option>
// <option value="1" class="active">Ferrari</option>
// <option value="2">Ford</option>
// <option value="3" selected="selected">Dodge</option>
// <option value="4">Toyota</option>
// </optgroup>
// </select>" |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I'm reading the documentation of inputSelect but I can't figure out how to setup or create an inputSelect multiple with more than one pre-selected values.
Could you please help me?
Beta Was this translation helpful? Give feedback.
All reactions