I have a table where I would like to show/hide fields based on values selected from a look up table. I have reviewed the US/States help section in the manual.
https://xlinesoft.com/asprunnernet/docs/show_dropdown_list_of_us_states.htm
My table requires multiple fields to be shown or hidden based on certain values selected from a look up table. The problem I am having is only the last value 'VP' seems to work. If other values are selected, the fields are not hidden or shown, as desired.
Here is my code that I have as an JavaScript OnLoad event on both my add and edit pages.
var ctrlPlatType = Runner.getControl(pageid, 'PlatType');
ctrlPlatType.on('change', function(e) {
if (this.getValue() == 'C1') {
pageObj.hideField("CPL");
} else {
pageObj.showField("CPL");
}
if (this.getValue() == 'C1') {
pageObj.hideField("Drawing");
} else {
pageObj.showField("Drawing");
}
if (this.getValue() == 'C1') {
pageObj.hideField("Registry_Drawing");
} else {
pageObj.showField("Registry_Drawing");
}
if (this.getValue() == 'C1') {
pageObj.hideField("PDF");
} else {
pageObj.showField("PDF");
}
if (this.getValue() == 'C3P') {
pageObj.hideField("CPL");
} else {
pageObj.showField("CPL");
}
if (this.getValue() == 'C3N') {
pageObj.hideField("PublicHearingRequirement");
} else {
pageObj.showField("PublicHearingRequirement");
}
if (this.getValue() == 'GP') {
pageObj.hideField("CPL");
} else {
pageObj.showField("CPL");
}
if (this.getValue() == 'VF') {
pageObj.hideField("CPL");
} else {
pageObj.showField("CPL");
}
if (this.getValue() == 'VF') {
pageObj.hideField("CAD_Drawing");
} else {
pageObj.showField("CAD_Drawing");
}
if (this.getValue() == 'VF') {
pageObj.hideField("Registry_Drawing");
} else {
pageObj.showField("Registry_Drawing");
}
if (this.getValue() == 'VF') {
pageObj.hideField("PDF");
} else {
pageObj.showField("PDF");
}
if (this.getValue() == 'VP') {
pageObj.hideField("CPL");
} else {
pageObj.showField("CPL");
}
if (this.getValue() == 'VP') {
pageObj.hideField("CAD_Drawing");
} else {
pageObj.showField("CAD_Drawing");
}
if (this.getValue() == 'VP') {
pageObj.hideField("Registry_Drawing");
} else {
pageObj.showField("Registry_Drawing");
}
if (this.getValue() == 'VP') {
pageObj.hideField("PDF");
} else {
pageObj.showField("PDF");
}
});
Please let me know if you seen anything wrong with my code. Thank you.