This topic is locked

Java Script Disable Field

1/30/2012 5:37:04 PM
PHPRunner General questions
T
Tempus_Erus author

Hi,
I need to disable field2 (dropdown box)on the add page subjetc to a value of a field1 - also on the add page, else it stays enabled.
In the onlad event I have placed the following code below:

I can enable/disable fields no problem, when when I get a value the below fails to work?

I would appreciate if someone could point me in the right direction......maybe its the sytax?
(field1 is an INT)
Thanks in advance.
var ctrlField1 = Runner.getControl(pageid, 'field1');

var ctrlField2 = Runner.getControl(pageid, 'field2');
if (ctrlField1.getValue()=='1')

{

ctrlField2.setEnabled();

}

else

{

ctrlOntimedepot.setDisabled();

}

C
cgphp 1/30/2012
var ctrlField1 = Runner.getControl(pageid, 'field1');

var ctrlField2 = Runner.getControl(pageid, 'field2');
ctrlField1.on('change',function(e){

if(this.getValue() == '1')

{

ctrlField2.setEnabled();

}

else

{

ctrlOntimedepot.setDisabled();

}

});
T
Tempus_Erus author 1/31/2012

Thanks for Gile.
I have tried this before, howver requires the field 1 to change before disabling the combox.Field 1 is a read only with an INT value. The value of this numeric field determins if the combo box is enabled or disbled.
ctrlField1.on('change',function(e){
Thanks again.