Funziona meglio sul tasto opzione. Ecco una funzione per disabilitare tutte le opzioni tranne quella attualmente attiva:
/**
* This function disables all options of the given selectElement, except for the active one
* @param \Zend_Form_Element_Select $selectElement
* @throws \Zend_Form_Exception
*/
private function disableAllOtherOptions(\Zend_Form_Element_Select $selectElement)
{
$theOneAndOnlyActiveValue = $selectElement->getValue();
$optionsToDisable = [];
foreach ($selectElement->options as $key => $option) {
if ($key <> $theOneAndOnlyActiveValue) {
$optionsToDisable[] = $key;
}
}
$selectElement->setAttrib('disable', $optionsToDisable);
}
fonte
2016-03-24 15:47:13
Grazie per il suggerimento. Non l'ho ancora provato, ma appena l'avrò ti farò sapere. –
Confermato in ZF 1.11.11. Questa risposta dovrebbe essere accettata invece. – LinusR
Questa risposta dovrebbe essere accettata perché è quella giusta. Ho provato, funziona. – darpet