• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 300
  • Last Modified:

parent innerHTML for FF and IE

I pass a value to a script via Iframe:

ifrHidden.location = 'update_enrichment_registration.cfm?ext_class1=' + document.callEntry.slotext_fc.value;


In Safari and IE the first class selection then updates the choices available for an alternate class:

<script language="JavaScript">
            var secCLassList = '';
            
            secCLassList += '<select name="slotext_sc" style="width:220px;">';
            <cfloop query="qry_Ext_class_second_choice">
            secCLassList += '<option value="#qry_Ext_class_second_choice.course_id#">#replace(qry_Ext_class_second_choice.course_name,"'","&rsquo;","ALL")#</option>';
            </cfloop>
            secCLassList += '</select>&nbsp;';
            
            parent.class_ext_sc.innerHTML = secCLassList;
      </script>  

But in FF it gives the error:

Error: TypeError: parent.class_ext_sc is undefined

How can this be fixed to support FF browsers? Thanks
0
bhinshawnc1
Asked:
bhinshawnc1
1 Solution
 
Michel PlungjanIT ExpertCommented:
Please Show the HTML of the target as seen by browser
0
 
mcnuteCommented:
It says that your variable is undefined. So probably it isn't visible for Firefox here. We need to see the whole script and page to tell you more. You left out the part where the variable is defined in your question. So it is hard to tell. Show us a link, jsfiddle or post the whole html and js here.
0
 
Roopesh ReddyIT AnalystCommented:
Hi,

This thread should solve your problem - http://stackoverflow.com/questions/8041566/parent-iframe-with-firefox-doesnt-work

Hope it helps u...
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Michel PlungjanIT ExpertCommented:
What I am waiting to see is what the object is try to access
If it is a div with ID then use
parent.document.getElementById("class_ext_sc").innerHTML
but if it us a field that only has a name then it is
parent.document.getElementsByName("class_ext_sc")[0].value
you need to use
0
 
bhinshawnc1Author Commented:
script:
<script language="JavaScript">
		var secCLassList = '';
		
		secCLassList += '<select name="slotext_sc" style="width:220px;">';
		<cfloop query="qry_Ext_class_second_choice">
		secCLassList += '<option value="#qry_Ext_class_second_choice.course_id#">#replace(qry_Ext_class_second_choice.course_name,"'","&rsquo;","ALL")#</option>';
		</cfloop>
		secCLassList += '</select>&nbsp;';
		
		parent.class_ext_sc.innerHTML = secCLassList;
		//parent.document.getElementsByName("class_ext_sc")[0].value = secCLassList;
	</script>

Open in new window

the html section:
<td width="6%" class="formlabel">
         <span class="req">*</span>Extended Class Alternate:
        </td>
        <td id="class_ext_sc" name="class_ext_sc"  class="formelement"> 
 	    
      <cfquery name="qry_Ext_class_second_choice" datasource="#request.dbname#" username="#request.dbuser#" password="#request.dbpw#">
            (SELECT enrichment_courses.course_id, enrichment_courses.course_name 
			FROM enrichment_courses
            WHERE enrichment_courses.elementary_course = 1 
            AND 
            enrichment_courses.active_status = 1
            AND 
            enrichment_courses.elem_session3 = 1
            AND 
            enrichment_courses.elem_ext_time_slot = 1
           )
           UNION
            (SELECT enrichment_reg_default_selections.course_id, 
			enrichment_reg_default_selections.course_name
			FROM enrichment_reg_default_selections
            WHERE enrichment_reg_default_selections.course_id NOT IN ('997')
            
            )
            ORDER BY course_id 
            
        </cfquery> 
    
         <select name="slotext_sc"  style="width:220px;" onmouseover="window.status='Select Extended class alternate choice';return true"
        onmouseout="window.status='Done';return true" >
        
       <option value=0 >Select First Choice</option>
           <cfloop query="qry_Ext_class_second_choice">
             <cfif qry_Ext_class_second_choice.course_ID is #show_registration.ext_class_second_choice#>
               <option value="#qry_Ext_class_second_choice.course_ID#" selected> #qry_Ext_class_second_choice.course_name#</option>
               <cfelse>
               <option value="#qry_Ext_class_second_choice.course_ID#">#qry_Ext_class_second_choice.course_name#</option>
               </cfif>
             </cfloop>
           </select>
       
        </td>

Open in new window

0
 
Michel PlungjanIT ExpertCommented:
It is a TD so NOT a form field, hence

parent.document.getElementById("class_ext_sc").innerHTML=secCLassList;
      
is the one to use assuming you want to REPLACE the
<select name="slotext_sc"
which is already in the cell
0
 
bhinshawnc1Author Commented:
Yes, I need to replace the select list based on option selected in another selection

tried parent.document.getElementById("class_ext_sc").innerHTML=secCLassList;

Still getting

Error: TypeError: parent.class_ext_sc is undefined
0
 
Michel PlungjanIT ExpertCommented:
that is unlikely. Are you sure you cleared your cache?
0
 
bhinshawnc1Author Commented:
Running FF 18.0.1, cleared cache, same error
0
 
Michel PlungjanIT ExpertCommented:
Can you send me a URL? My email is in my profile
0
 
bhinshawnc1Author Commented:
sorry can't send URL, internal dev platform behind firewall - what can I post that would help?
0
 
Michel PlungjanIT ExpertCommented:
The issue is that I am surprised you get
parent.class_ext_sc is undefined
after using parent.document.getElementById so I suspect you are still seeing old code in the iframe. Can you load the iframe on its own and Ctrl-f5 it to see if you now get the same error because there is no parent,
0
 
bhinshawnc1Author Commented:
loaded the iframe on its own - still got the same error
0
 
Michel PlungjanIT ExpertCommented:
And you can see
parent.document.getElementById("class_ext_sc").innerHTML=secCLassList;
when you do view source and you get
parent.class_ext_sc is undefined
???

that is what bothers me.
you should get

parent.document.getElementById("class_ext_sc") is undefined

time to load firebug and debug the page
0
 
bhinshawnc1Author Commented:
thanks for assistance
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now