A
A
Andrew2016-02-03 09:40:07
Zend Framework
Andrew, 2016-02-03 09:40:07

Zend Framework 1. How to add an empty item select form?

Hello, I am creating a form with a drop-down list, but the form is created all filled with values, and I did not find how to create the form correctly, so that with a standard empty first select item, for example, with the inscription "Select ..."

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Cat Anton, 2016-02-03
@ntzch

Zend Framework 2 has a .
framework.zend.com/manual/current/en/modules/zend....
Empty_option.
In Zend Framework 1, it's a little more complicated:

$select = new Zend_Form_Element_Select('select');
$select->setMultiOptions(array(
    -1 => 'Выберите...',
    0 => 'Значение 0',
    1 => 'Значение 1',
    1 => 'Значение 2',
));
$select->addValidator(new Zend_Validate_GreaterThan(-1), false);

stackoverflow.com/questions/11570888/zend-form-ele...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question