This topic is locked

Conditionally hide fields per row based on another field value

12/30/2021 8:30:05 PM
PHPRunner General questions
D
Dynamiccomp author

Is there anyway to do this, I know how to hide individual fields for a table, but is there a way to hide fields per row based on a value?

For example:

I have a table to enter scores fields (score1 to score22), and I also have multiple "Divisions" in that same table, where each division has a different number of scores, so i want to be able to hide the scores that will not be needed based on the value of the "Division field.

Like:

If I had the Division "BN" for those rows i would want to hide fields (Score19 - Score22)

Not sure how this can be done, but would appreciate a few pointers.

M
Mark Kramer 3/23/2022

Here I hide or show fields base on a checked value field.
This code goes in the addpage JavaScript Onload event and is for insperation.

var name = Runner.getControl(pageid,'PoolNameNumber');
var type = Runner.getControl(pageid, 'Type');
var bromine = Runner.getControl(pageid, 'BromineLevel');
var chorine = Runner.getControl(pageid, 'ChlorineLevel');
var salt = Runner.getControl(pageid, 'SaltConcentration');

type.on('change', function (e) {

if (this.getValue() == 'Freshwater Pool') {
pageObj.showField("ChlorineLevel");

chorine.show();
pageObj.hideField("BromineLevel");
pageObj.hideField("SaltConcentration");

bromine.hide();
salt.hide();

} else {
if (this.getValue() == 'Fresh Water Hot Tub') {

pageObj.hideField("ChlorineLevel");
chorine.hide();
pageObj.hideField("SaltConcentration");

salt.hide();
pageObj.showField("BromineLevel");
bromine.show();

} else {

if (this.getValue() == 'Saltwater Hot Tub') {

pageObj.hideField("ChlorineLevel");
chorine.hide();
pageObj.showField("BromineLevel");
bromine.show();
pageObj.showField("SaltConcentration");

salt.show();

} else {
if (this.getValue() == 'Saltwater Pool') {

pageObj.hideField("BromineLevel");
bromine.hide();
pageObj.showField("ChlorineLevel");

chorine.show();
pageObj.showField("SaltConcentration");

salt.show();

}
}
}
}
});