我正在使用zend表單來創建表單。我也爲JavaScript使用mootools。將onclick事件應用於選項
$this->addElement('radio', 'alone', array(
'label' => 'Are you going to be taking part with anyone else?',
'required' => true,
'onClick' => 'showFields();',
'multiOptions' => array(
'yes' => 'Yes',
'no' => 'No'
))
);
目前,如果選擇任何選項,onclick事件工作。我如何才能讓它只爲被選中而工作?
讓你'showFields的第一行()'函數驗證'yes'選擇在做其他事情之前 –