Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable a form element in symfony?

I am using a Select element, in form

'country' =>new sfWidgetFormChoice(array('choices' => CountryPeer::getAllCountry())),

'city' =>new sfWidgetFormChoice(array('choices' => CityPeer::getAllCity())),

i want that city element to be disabled, at the first time when the page loads. and on selection of country the city element will be enabled.(it will be loaded through AJAX call)

like image 273
Harish Kurup Avatar asked Dec 08 '22 05:12

Harish Kurup


1 Answers

You can disable like this

$this->widgetSchema['country']->setAttribute('disabled', 'disabled');

like image 172
metoikos Avatar answered Dec 31 '22 12:12

metoikos