troubleshooting Question

Javascript visible/hidden with CF and IE11

Avatar of diecasthft01
diecasthft01 asked on
JavaScriptColdFusion Language
8 Comments1 Solution131 ViewsLast Modified:
Good morning all!! I have a question related to ColdFusion, JavaScript and IE11. I have some code, that works fine in compatibility view in IE11, that basically is three drop downs, all containing results of a database query. Only the first dropdown is visible at the beginning. If the user selects "More" from the first drop down box, the second box becomes visible. Then if in that second box, a users selects a certain item, the third box will appear. I need to make this work without the dependency of adding the domain to the compatibility view. I thought it would work with no issues, but I was very wrong. Could someone guide me on what I need to change/do to make this work??

<SCRIPT LANGUAGE="JavaScript">	  
function objectShowForm(thisObject, thatObject) {

     // Check for invalid object references
     if (!thisObject || !thatObject) {return false;}
     
     // Get the selected value 
     // (currently only works with single selection lists and text fields)
     if (thisObject.type == "select-one") {
          listIndex = thisObject.selectedIndex;
          var value = thisObject.options[listIndex].value; // you can also use .text
     } else if (thisObject.type == "text") {
          var value = thisObject.value;
     }

     // Show or hide the hidden field
     if (value == "99"){
          showElement(thatObject.name);
     } else {
          hideElement(thatObject.name);
     }
     return true;
}
	
function showElement(elem) {
     if (!elem) {return false;}     // check for invalid object reference
     document.getElementById(elem).style.visibility='visible';
     return true;
}

function hideElement(elem) {
     if (!elem) {return false;} // check for invalid object reference
     document.getElementById(elem).style.visibility='hidden';
     return true;
}	
</script>	  
	
<cfoutput>         
<cfform>

<table width="900" border="0" bgcolor="CCCCCC" style="margin-left: -10"> 
 <TR>
<td width="115">      
 <select id="select1" name="userID" size="1" onChange="objectShowForm(this, this.form.optother); selectUser(this)">
<option value="999">Select</option>
<CFLOOP query="getContact">
<option value="#getContact.FUNDING_TO#">#getContact.FUNDING_TO#</option></CFLOOP>
<OPTION value="99">More</OPTION>
</SELECT></TD>

<td width="194"><select id="select2" name="optother" size="1" style="visibility: hidden;">
<option value="999">Select</option>
<CFLOOP query="getContact1">
<option value="#getContact1.FUNDING_TO#">#getContact1.FUNDING_TO#</option></CFLOOP>
</SELECT></td>

<td width="418"><select id="select3" name="optotherPM" size="1" style="visibility: hidden;">
<option value="999">Select</option>
<CFLOOP query="getContact2">
<option value="#getContact2.FUNDING_TO#">#getContact2.FUNDING_TO#</option></cfloop>
</SELECT></td>
</tr></table>  

</cfform></CFOUTPUT>
ASKER CERTIFIED SOLUTION
Nikoloz Khelashvili
Software Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros