Solved

parent innerHTML for FF and IE

Posted on 2013-01-23
15
290 Views
Last Modified: 2013-01-29
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
Comment
Question by:bhinshawnc1
15 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 38813751
Please Show the HTML of the target as seen by browser
0
 
LVL 11

Expert Comment

by:mcnute
ID: 38814366
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
 
LVL 23

Expert Comment

by:Roopesh Reddy
ID: 38814650
Hi,

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

Hope it helps u...
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 38814787
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
 
LVL 3

Author Comment

by:bhinshawnc1
ID: 38816982
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
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 500 total points
ID: 38817560
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
 
LVL 3

Author Comment

by:bhinshawnc1
ID: 38818715
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 38819745
that is unlikely. Are you sure you cleared your cache?
0
 
LVL 3

Author Comment

by:bhinshawnc1
ID: 38819777
Running FF 18.0.1, cleared cache, same error
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 38819938
Can you send me a URL? My email is in my profile
0
 
LVL 3

Author Comment

by:bhinshawnc1
ID: 38820037
sorry can't send URL, internal dev platform behind firewall - what can I post that would help?
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 38820327
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
 
LVL 3

Author Comment

by:bhinshawnc1
ID: 38820424
loaded the iframe on its own - still got the same error
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 38820790
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
 
LVL 3

Author Closing Comment

by:bhinshawnc1
ID: 38831466
thanks for assistance
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now