this.hideField("form_jeniskp_1");
this.hideField("form_jeniskp_2");
this.hideField("form_jeniskp_3");

this.onFieldChange("select_1", (value) => {
  this.hideField("form_jeniskp_1");
  this.hideField("form_jeniskp_2");
  this.hideField("form_jeniskp_3");
  if (value && value.trim()) {
    if (value == "jeniskp_1") this.showField("form_jeniskp_1");
    if (value == "jeniskp_2") this.showField("form_jeniskp_2");
    if (value == "jeniskp_3") this.showField("form_jeniskp_3");
  }
});
// Conditional Logic Script

// Conditional Logic Script

// Conditional Logic Script

// Conditional Logic Script

// Conditional Logic Script

// Conditional Logic Script

// Conditional logic for field: nyatakan_lain2
onFieldChange("radio_bangsa", function () {
  if (getField("radio_bangsa") !== "lain") {
    hideField("nyatakan_lain2");
  } else {
    showField("nyatakan_lain2");
  }
});

// Initial evaluation for field: nyatakan_lain2
(function () {
  if (getField("radio_bangsa") !== "lain") {
    hideField("nyatakan_lain2");
  } else {
    showField("nyatakan_lain2");
  }
})();
// Conditional Logic Script

// Conditional logic for field: nyatakan_lain2
onFieldChange("radio_bangsa", function () {
  if (getField("radio_bangsa") !== "lain") {
    hideField("nyatakan_lain2");
  } else {
    showField("nyatakan_lain2");
  }
});

// Initial evaluation for field: nyatakan_lain2
(function () {
  if (getField("radio_bangsa") !== "lain") {
    hideField("nyatakan_lain2");
  } else {
    showField("nyatakan_lain2");
  }
})();
// Conditional Logic Script

// Conditional logic for field: nyatakan_lain2
onFieldChange("radio_bangsa", function () {
  if (getField("radio_bangsa") !== "lain") {
    hideField("nyatakan_lain2");
  } else {
    showField("nyatakan_lain2");
  }
});

// Initial evaluation for field: nyatakan_lain2
(function () {
  if (getField("radio_bangsa") !== "lain") {
    hideField("nyatakan_lain2");
  } else {
    showField("nyatakan_lain2");
  }
})();

// Conditional logic for field: text_14
onFieldChange("radio_pendidikan", function () {
  if (getField("radio_pendidikan") !== "lain") {
    hideField("text_14");
  } else {
    showField("text_14");
  }
});

// Initial evaluation for field: text_14
(function () {
  if (getField("radio_pendidikan") !== "lain") {
    hideField("text_14");
  } else {
    showField("text_14");
  }
})();
// Conditional Logic Script

// Conditional logic for field: nyatakan_lain2
onFieldChange("radio_bangsa", function () {
  if (getField("radio_bangsa") !== "lain") {
    hideField("nyatakan_lain2");
  } else {
    showField("nyatakan_lain2");
  }
});

// Initial evaluation for field: nyatakan_lain2
(function () {
  if (getField("radio_bangsa") !== "lain") {
    hideField("nyatakan_lain2");
  } else {
    showField("nyatakan_lain2");
  }
})();

// Conditional logic for field: text_14
onFieldChange("radio_pendidikan", function () {
  if (getField("radio_pendidikan") !== "lain") {
    hideField("text_14");
  } else {
    showField("text_14");
  }
});

// Initial evaluation for field: text_14
(function () {
  if (getField("radio_pendidikan") !== "lain") {
    hideField("text_14");
  } else {
    showField("text_14");
  }
})();
// Conditional Logic Script

// Conditional logic for field: nyatakan_lain2
onFieldChange("radio_bangsa", function () {
  if (getField("radio_bangsa") !== "lain") {
    hideField("nyatakan_lain2");
  } else {
    showField("nyatakan_lain2");
  }
});

// Initial evaluation for field: nyatakan_lain2
(function () {
  if (getField("radio_bangsa") !== "lain") {
    hideField("nyatakan_lain2");
  } else {
    showField("nyatakan_lain2");
  }
})();

// Conditional logic for field: text_14
onFieldChange("radio_pendidikan", function () {
  if (getField("radio_pendidikan") !== "lain") {
    hideField("text_14");
  } else {
    showField("text_14");
  }
});

// Initial evaluation for field: text_14
(function () {
  if (getField("radio_pendidikan") !== "lain") {
    hideField("text_14");
  } else {
    showField("text_14");
  }
})();
// Conditional Logic Script

// Conditional logic for field: nyatakan_lain2
onFieldChange("radio_bangsa", function () {
  if (getField("radio_bangsa") !== "lain") {
    hideField("nyatakan_lain2");
  } else {
    showField("nyatakan_lain2");
  }
});

// Initial evaluation for field: nyatakan_lain2
(function () {
  if (getField("radio_bangsa") !== "lain") {
    hideField("nyatakan_lain2");
  } else {
    showField("nyatakan_lain2");
  }
})();

// Conditional logic for field: text_14
onFieldChange("radio_pendidikan", function () {
  if (getField("radio_pendidikan") !== "lain") {
    hideField("text_14");
  } else {
    showField("text_14");
  }
});

// Initial evaluation for field: text_14
(function () {
  if (getField("radio_pendidikan") !== "lain") {
    hideField("text_14");
  } else {
    showField("text_14");
  }
})();
// Conditional Logic Script

// Conditional logic for field: nyatakan_lain2
onFieldChange("radio_bangsa", function () {
  if (getField("radio_bangsa") !== "lain") {
    hideField("nyatakan_lain2");
  } else {
    showField("nyatakan_lain2");
  }
});

// Initial evaluation for field: nyatakan_lain2
(function () {
  if (getField("radio_bangsa") !== "lain") {
    hideField("nyatakan_lain2");
  } else {
    showField("nyatakan_lain2");
  }
})();

// Conditional logic for field: text_14
onFieldChange("radio_pendidikan", function () {
  if (getField("radio_pendidikan") !== "lain") {
    hideField("text_14");
  } else {
    showField("text_14");
  }
});

// Initial evaluation for field: text_14
(function () {
  if (getField("radio_pendidikan") !== "lain") {
    hideField("text_14");
  } else {
    showField("text_14");
  }
})();

// Hide "Nyatakan Hubungan Lain-lain" initially
this.hideField("hubungan_lain_nyatakan");

// Show/hide relationship specification field
this.onFieldChange("hubungan_keluarga", (value) => {
  if (value && value.includes("lain_lain")) {
    this.showField("hubungan_lain_nyatakan");
  } else {
    this.hideField("hubungan_lain_nyatakan");
  }
});

// Hide "Sebab Pembayaran Tunai" initially
this.hideField("sebab_tunai");

// Show/hide cash payment reason field
this.onFieldChange("cara_pembayaran", (value) => {
  if (value && value.includes("tunai")) {
    this.showField("sebab_tunai");
  } else {
    this.hideField("sebab_tunai");
  }
});

// Hide education specification field initially
this.hideField("pendidikan_lain_tanggungan");

// Show/hide education specification field
this.onFieldChange("pendidikan_tertinggi_tanggungan", (value) => {
  if (value && value.includes("lain_lain")) {
    this.showField("pendidikan_lain_tanggungan");
  } else {
    this.hideField("pendidikan_lain_tanggungan");
  }
});

// Hide school information initially
this.hideField("maklumat_sekolah");

// Show/hide school information based on schooling status
this.onFieldChange("bersekolah_tanggungan", (value) => {
  if (value === "ya") {
    this.showField("maklumat_sekolah");
  } else {
    this.hideField("maklumat_sekolah");
  }
});

// Handle repeating group conditional logic for each dependent
this.onFieldChange("tanggungan_maklumat", (value) => {
  if (value && Array.isArray(value)) {
    value.forEach((item, index) => {
      // Handle race specification for each dependent
      if (item.bangsa_tanggungan !== "lain_lain") {
        // Hide the specification field for this item
        const fieldName = `tanggungan_maklumat[${index}].bangsa_lain_tanggungan`;
        // Note: Repeating group field hiding requires specific handling
      }
    });
  }
});
