In SuiteCRM, For enable/disable Related Field follow below code ,
if($(’#province_c’).val() == “”){
$("#btn_city_c").attr(“disabled”, true);
$("#btn_barangay_c").attr(“disabled”, true);
}else{
$("#btn_city_c").attr(“disabled”, false);
$("#btn_barangay_c").attr(“disabled”, false);
}
if($(’#city_c’).val() == “”){
$("#btn_barangay_c").attr(“disabled”, true);
}else{
$("#btn_barangay_c").attr(“disabled”, false);
}
var inputName = “input[name=‘province_c’]”;
YAHOO.util.Event.addListener(YAHOO.util.Selector.query(inputName), ‘change’, function(){
$("#btn_city_c").attr(“disabled”, false);
});
var inputName = “input[name=‘city_c’]”;
YAHOO.util.Event.addListener(YAHOO.util.Selector.query(inputName), ‘change’, function(){
$("#btn_barangay_c").attr(“disabled”, false);
});
$(’#btn_clr_province_c’).on(‘click’, function(){
SUGAR.clearRelateField(this.form,‘city_c’,‘city_id_c’);
SUGAR.clearRelateField(this.form,‘barangay_c’,‘barangay_id_c’);
$("#btn_city_c").attr(“disabled”, true);
$("#btn_barangay_c").attr(“disabled”, true);
});
$(’#btn_clr_city_c’).on(‘click’, function(){
SUGAR.clearRelateField(this.form,‘barangay_c’,‘barangay_id_c’);
$("#btn_barangay_c").attr(“disabled”, true);
});
See the below screenshots,