troubleshooting Question

cfdiv not regonising variables

Avatar of Shawn
ShawnFlag for Canada asked on
Web Servers
16 Comments1 Solution534 ViewsLast Modified:
I am using cfdiv to update a query and a menu every time a radio button is changed.

problem is I'm a little lost. I am getting the error that the variable is undefined.

In the main page I have
the script:
<script type="text/javascript">
updateStatus = function()  {
  ColdFusion.navigate('members/InternalTemplates.cfm','ITemplates');
}
</script>
the cfdiv:
<cfdiv id="ITemplates" bind="url:members/InternalTemplates.cfm"></cfdiv>

and below it the radio button:
      <input type="radio" name="TemplateLanguage" id="TemplateLanguage" value="2" onClick="updateStatus();"
               <cfif getActiveTranslation.ClientLanguage eq 2>checked</cfif>>
              French
      <input type="radio" name="TemplateLanguage" id="TemplateLanguage" value="1" onClick="updateStatus();"
        <cfif getActiveTranslation.ClientLanguage eq 1>checked</cfif>>
              English

what am I mixing up?
InternalTemplates.cfm
 
      <cfif not IsDefined("session.memberID")>
        <cflocation url="#script_name#?action=members.login2" addtoken="No">
      </cfif>
 
<cfif getActiveTranslation.ClientLanguage eq 2>
<cfset TemplateLanguage = 2>
<cfelse>
<cfset TemplateLanguage = 1>
</cfif>
 
 
<cfif TemplateLanguage eq 2>
<cfquery name="getEmails" datasource="#application.DSHome#" username="#application.dbuserHome#" password="#application.dbpassHome#">
SELECT EmailTemplateID
      ,TemplateTitle
      ,EmailSubjectFrench AS EmailSubject
      ,EmailBodyFrench AS EmailBody
  FROM tblEmailTemplate
</cfquery>
<cfelse>
<cfquery name="getEmails" datasource="#application.DSHome#" username="#application.dbuserHome#" password="#application.dbpassHome#">
SELECT EmailTemplateID
      ,TemplateTitle
      ,EmailSubject
      ,EmailBody
  FROM tblEmailTemplate
</cfquery>
</cfif>
 
<script type="text/javascript">
// this is a js array of objects from the query data
var arrTemplates = [<cfoutput query="getEmails">
					{'etid':#EmailTemplateID#, 'subj':'#jsstringformat(EmailSubject)#', 'body':'#jsstringformat(EmailBody)#'}
					<cfif getEmails.currentrow LT getEmails.recordcount>,</cfif></cfoutput>];
 
// this function is executed in onchange() event of the select drop-down and populates the 2 form fields with data from the above js array
var showTemplate = function(id) {
  if (id > 0) {
    for (var x=0; x<arrTemplates.length; x++) {
      if (arrTemplates[x].etid == id) {
        document.getElementById('Subject').value = arrTemplates[x].subj;
        document.getElementById('fEmailBody').value = arrTemplates[x].body;
      }
    }
  }
};
</script>
 
 
<div class="TemplateMenu">
<ul>
<li><a href="">Templates</a>
<!--[if lte IE 6]>
<a href="../menu/index.html">Templates
<table><tr><td>
<![endif]-->
	<ul>
    <cfoutput query = "getEmails">
        <cfif getEmails.RecordCount IS not 0>
        <li><a class="hide"  title="choose this template" href="##" onclick="showTemplate(#EmailTemplateID#); return false;">#TemplateTitle#</a>
        <!--[if lte IE 6]>
    	<a class="sub" href="#EmailTemplateID#" title="choose this template">#TemplateTitle#
    	<table><tr><td>
    	<![endif]-->
        
        	<ul>
				<li><a href="##" onclick="showTemplate(#EmailTemplateID#); return false;" title="choose this template">#EmailSubject#<br>***<br>#EmailBody#</a></li>
			</ul>
		<!--[if lte IE 6]>
		</td></tr></table>
    	</a>
    	<![endif]-->
		
        </li>
        <cfelse>
        <li><a href="">*** no templates ***</a></</li>
        </cfif>        
    	</cfoutput>
</ul>	
<!--[if lte IE 6]>
</td></tr></table>
</a>
<![endif]-->
</li>
</ul>
</div>
ASKER CERTIFIED SOLUTION
azadisaryev

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 16 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 16 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