We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How to set empty value in drop-down box in volt.

i want to set the following as default thing for the drop down..<option value="" selected="">Wallet Types</option> for this i have tried the follwing... $value = new Select('name[]', Value::find("[is_active] = 1"), array( 'using' => array('id', 'value_name'), 'multiple' => 'multiple', 'emptyText' => 'Wallet Type', 'emptyValue' => '', 'selected'=>"", )); //->emptyText('Wallet Type'); $value->setAttribute('id', 'valuetypes'); $value->setLabel('Wallet Type'); //$wallet->setEmpty('',''); $this->add($value);

How to do this???

$products = Products::find("type = 'vegetables'");

// Creating a Select Tag with an empty option
echo $this->tag->select(
    [
        "productId",
        $products,
        "using"    => [
            "id",
            "name",
        ],
        "useEmpty" => true,
    ]
);

https://docs.phalcon.io/en/latest/reference/tags.html#making-select-boxes