This topic is locked

Disable Field Based on Dropdown

6/30/2011 6:32:02 AM
PHPRunner General questions
P
prattster1874 author

Been through the other threads on the subject, and the manual.
Can anyone see anything obviously wrong with this? :

var ctrltype = runner.getControl(pageid, 'type_id');

var ctrlstatus = runner.getControl(pageid, 'model_status');
ctrltype.on('change', function(e){

if (this.getValue() ==1{
ctrlstatus.setEnabled();



}else{

ctrlstatus.setDisabled();

ctrlstatus.setValue("");

}
});


Added to the JavaScript On Load event in the add page

C
cgphp 6/30/2011

You haven't closed the round bracket of the "if" statement and runner must be capitalized:

var ctrltype = Runner.getControl(pageid, 'type_id');

var ctrlstatus = Runner.getControl(pageid, 'model_status');
ctrltype.on('change', function(e){

if (this.getValue() ==1){
ctrlstatus.setEnabled();



}else{

ctrlstatus.setDisabled();

ctrlstatus.setValue("");

}
});