Hi,
Im trying to hide or disable a field on Portal, but i cant figure it out. I've tried the two JS below and added it to the Entity Form. I also as a test, added it in 3 places, the Entity Form, Web Page, and using the Front-Side editor (not sure which is the preferred method). No luck.
Its a custom entity. Lets assume the field names are new_field1 an new_field2. I want to hide new_field2 if new_field1 is null
$(document).ready(function() { $("#new_field2").change(SetFieldsVisibility); $("#new_field2").change(); }); function SetFieldsVisibility() { var Field1 = $("#new_field1").val(); if (Field1 === null) { $("#new_field2").closest("tr").hide(); } else { $("#new_field2").closest("tr").show(); } }
function setFieldDisplay(new_field1, new_field2) { if (new_field1 == null) { $("#" + new_field2).closest("tr").show() } else if (new_field1 !== null) { $("#" + new_field2).closest("tr").hide() } }