This topic is locked

Hiding fields on edit page within tabs

9/19/2020 4:14:20 PM
PHPRunner General questions
D
david22585 author

I have the JS code working to hide certain fields based upon a dropdown selection on 1 page. On another page using the same code (same fields), I have the information on a tab with other data, including the dropdown selection. When the dropdown selection is = 0, it should hide the fields, but it doesn't. Does something change when the fields are within a tab?
This is the code being used:

var ctrlRental = Runner.getControl(pageid, 'rental');
ctrlRental.on('change', function(){

if (this.getValue() == '1') {

pageObj.showField("tenantname");

pageObj.showField("tenantphone");

pageObj.showField("tenantemail");

pageObj.showField("permaddress");

pageObj.showField("leasestartdate");

pageObj.showField("leaseenddate");

pageObj.showField("document");

} else if (this.getValue() == '0') {

pageObj.hideField("tenantname");

pageObj.hideField("tenantphone");

pageObj.hideField("tenantemail");

pageObj.hideField("permaddress");

pageObj.hideField("leasestartdate");

pageObj.hideField("leaseenddate");

pageObj.hideField("document");

}

})
Sergey Kornilov admin 9/19/2020

It will work the same way in the tab as it does on the regular page.
First of all, make sure there are no Javascript errors on the page. Maybe you have errors somewhere else and it breaks all the Javascript on that page.
If there are no errors you need to set a breakpoint on the following line and step through the code to see which branch gets executed.

if (this.getValue() == '1') {


Here is the video that will take you through all the steps:

https://www.youtube.com/watch?v=o5o18eawWpE