Answer the question
In order to leave comments, you need to log in
How to set 'disabled' attribute for 'select' tag in Zend Framework 2?
I create a form:
<?php
namespace City\Form;
use Zend\Form\Form;
class City extends Form
{
public function __construct() {
parent::__construct('city');
$this->setAttribute('action', 'getcity');
$this->setAttribute('method', 'post');
$this->setInputFilter(new \CIty\Form\CityFilter());
$this->add(array(
'name' => 'city',
'type' => 'Select',
'attributes' => array(
'id' => 'city',
),
'options' =>
'empty_option' => '--Select city--',
'value_options' => array(
'0' => 'Moscow',
'1' => 'St. Petersburg',
'2' => 'Dmitrov',
'3' => 'Another city',
),
),
));
}
}
How can I set the 'disabled' attribute for one of the option values, for example: 'Different city'?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question