jscript to enable or disable text box based on drop down list

Hi,

 

I'm trying to do a simple jscript to determine whether some specific text box is enabled or not in v9. My jscript is as below.  function addOnLoad is called during form load and all dependencies of the involved form control is ok when i test it on server side.

Can someone share any idea why it's not working??

 

 

function addOnLoad()
{
  $find("myDropDownList")._element.onchange =
  function () { testDisable(); };

}

function testDisable()
{
 if(($find("myRadioButton").get_value())=="radioValue 1" && ($find("myDropDownList").get_selectedItem())=="dropDownValue1")
 {
  $find("textboxA").editor.enable();
  $find("textboxB").editor.disable();
 }
 if(($find("myRadioButton").get_value())=="radioValue 1" && ($find("myDropDownList").get_selectedItem())=="dropDownValue2")
 {
  $find("textboxB").editor.enable();
  $find("textboxA").editor.disable();
 }
 else
 {
  $find("textboxA").editor.disable();
  $find("textboxB").editor.disable();
 }

Tagged: