Determine if field exists
Hi all,
Have asituation where I have icons associated with 'parent' text fields. Trying to build a function to hide all (part of a reset process but built to hide 1 set at a time). The problem is, I get errors if the icon doesn't exist for a given parent.
function clearIcons(buildingName, buildingNameOrig){
buildingName = buildingNameOrig+"_Elec_af_image"; // Convert field name to icon name from safe var
if(typeof(buildingName) != "undefined"){
this.getField(buildingName).display = 1; } // Hide the icon
buildingName = buildingNameOrig+"_Water_af_image"; // Convert field name to icon name from safe var
if(typeof(buildingName) != "undefined"){
this.getField(buildingName).display = 1; } // Hide the iconIn this case, it's fine if all parent buildings have electrical and water connections but fails if a building only has 1. I think I just need the correct method of detecting a fields absence for the 'if' statement but if there's a better way to do, I'm open.
Thanks,