我在表单中使用 Select 元素
'country' =>new sfWidgetFormChoice(array('choices' => CountryPeer::getAllCountry())),
'city' =>new sfWidgetFormChoice(array('choices' => CityPeer::getAllCity())),
我希望在第一次加载页面时禁用该城市元素。并在选择国家/地区时启用城市元素。(它将通过 AJAX 调用加载)
最佳答案
你可以这样禁用
$this->widgetSchema['country']->setAttribute('disabled', 'disabled');
关于php - 如何禁用 symfony 中的表单元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1796138/