2009年4月29日星期三

[fw-mvc] dijit.byId issue for Zend_Dojo RadioButton

There are RadioButton and CurrencyTextBox on the page and I'm trying
to disable them but dijit.byId works fine for the CurrencyTextBox and
returns undefined for the RadioButton.

In the Form:

$this->addElement(
'RadioButton',
'[radio_button_id]',
array(
'label' => 'label',
'multiOptions' => array(
'name1' => 'value1',
'name2' => 'value2'
),
'value' => 'name1'
)
);

$this->addElement(
'CurrencyTextBox',
'[currency_text_box_id]',
array(
'label' => 'label',
'required' => true,
'currency' => [currency],
'invalidMessage' => [message],
'fractional' => true
)
);

In the View:

function () {
//doesn't work - radio_button is undefined
var radio_button = dijit.byId("[radio_button_id]");
radio_button.attr('disabled', true);

//works
var currency_text_box = dijit.byId("[currency_text_box_id]");
currency_text_box.attr('disabled', true);
}

How could I fix it? Many thanks for any help.

没有评论: