Solved

Bind Failed: element not found XXXXXX (CF 9.0.1)

Posted on 2011-02-15
2
1,498 Views
Last Modified: 2012-06-22
I have multiple Bind Failed errors.   Specifically "Bind Failed, element not found: classes"
When I use cfdebug added to the URL I see:

info:widget: Creating window: cw2

error:bind: Bind failed, element not found: classes
Also, at least one cfwindow will spawn when the page loads.

These errors relate to multiple cfgrids inside of multple cflayout 'tabs' all with javascript for calling a cfwindow when a row is clicked on.

I'm hoping someone can see what I'm missing in all of this.



Here is my code for the cfwindow that I have in the page header:
<!--- Training page modal window  BEGIN--->
<cfif isDefined('URL.page') AND URL.page EQ '4'>
<cfajaximport tags="CFWINDOW, CFGRID, CFFORM">

<cfwindow  name="cw2" bodyStyle="background-color: white;" destroyOnClose="false" title="Class Detail"  refreshonshow="true"  modal="false" center="true"  initshow="false" width="650" height="350"
 source="training/classes/classInfo.cfm?id={f2:classes.ID@click}"/>
 </cfif>
<!--- Training page modal window END--->

Open in new window


Here is the code for the page:
<cfquery name="getMyClasses" datasource="this.DSN">
SELECT *
FROM dbo.Contacts
WHERE PIN = '#SESSION.UserID#'
</cfquery>

<cfquery name="checkUserTraining" datasource="this.DSN">
SELECT *
FROM UserTraining
WHERE ContactID = '#getMyClasses.ID#'
AND completed <> 'yes'
</cfquery>
<cfset SESSION.empID = '#getMyClasses.ID#'>

<cfparam name="current_date" default="#DateFormat(Now(), 'MM/DD/YYYY')#">

<div style="text-align:left; padding: 10px;">

<span style="font-weight:bold;">Employee Profile</span>
<ul>
  <li style="list-style:none;"><strong>Name:</strong>&nbsp;<strong><cfoutput>#getMyClasses.Full_Name#</cfoutput></strong></li>
  <li style="list-style:none;"><strong>Dept:</strong> &nbsp;<cfoutput>#getMyClasses.Branch#</cfoutput></li>
 
  <li style="list-style:none;">Title: &nbsp;<cfoutput>#getMyClasses.Job_Title#</cfoutput></li>
  <li style="list-style:none;">Location:&nbsp; <cfoutput>#getMyClasses.BLDG#</cfoutput></li>
  
 </ul>
</div>

<div style="text-align:left; width: 700px; padding-left:8px;">
    <cflayout type="tab" tabHeight="450" name="myclasses"  tabStrip="false" >
      <cflayoutarea title="All & Non-Supervisors" overflow="visible" source="training/classes/all_nonsupervisor.cfm" refreshOnActivate="true"  />
         
      
        <cflayoutarea title="Job Series Specific" overflow="visible" source="training/classes/all_jobseries.cfm" refreshOnActivate="true"  />

      <cflayoutarea title="Hourly Requirement Based" overflow="visible" source="training/classes/all_hourly.cfm" refreshOnActivate="true"  />
        
      <cfif isDefined('getMyClasses.job_series') AND getMyClasses.job_series EQ '12' OR getMyClasses.job_series EQ '13' OR getMyClasses.job_series EQ '14'>
        <cflayoutarea title="Intern" overflow="visible"  source="training/classes/all_intern.cfm" refreshOnActivate="true"  />
         </cfif>
     
</cflayout>
</div>

Open in new window


Here is the code for one of the cfgrids (all the grids are essentially the same, just pulling slightly different data):

<cfquery name="getMyClasses" datasource="this.dsn">
SELECT *
FROM dbo.Contacts
WHERE PIN = '#SESSION.UserID#'
</cfquery>




<script type="text/javascript">
function ClassDetailWindow(empid2) {
      ColdFusion.Window.show('cw2');
}
</script>
<!--- Create cfform, cgrid, cfinput --->
<!--- Use this a springboard to detect selection in grid, and execute Javascript function --->
<cfform name="f2" id="f2" format="html" style="padding-left:3px; padding-top:4px;">
<cfinput type="hidden" id="class_filter" name="class_filter" value="#trim(getMyClasses.ID)#">
     <cfgrid name="classes"
            format="html"
            striperows="yes"
             pagesize="10"
             preservepageonsort="true"
            bind="cfc:classes.allclasses({cfgridpage},
                                        {cfgridpagesize},
                                        {cfgridsortcolumn},
                                        {cfgridsortdirection},
                                        {class_filter@none}
                                        )"
           
            autoWidth="yes" collapsible="false"  title="Mandatory" colheaderbold="yes"  selectcolor="##D5EDB3" selectonload="false" >
        <cfgridcolumn name="ID" display="no"/>
        <cfgridcolumn name="course_name" header="Course" width="220"  />
        <cfgridcolumn name="description" header="Description" width="300" />
        <cfgridcolumn name="date" mask="m/d/y" header="Due Date" width="170"  />
    </cfgrid>
    <cfinput type="hidden" name="t2" bindonload="false" bind="javascript:ClassDetailWindow({f2:classes.ID@click})"/>
</cfform>

Open in new window

0
Comment
Question by:rrattie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 29

Expert Comment

by:Pravin Asar
ID: 34908786
Keep the statement out of <cfif>

<cfajaximport tags="CFWINDOW, CFGRID, CFFORM">

<cfif isDefined('URL.page') AND URL.page EQ '4'>
<cfwindow  name="cw2" bodyStyle="background-color: white;" destroyOnClose="false" title="Class Detail"  refreshonshow="true"  modal="false" center="true"  initshow="false" width="650" height="350"
 source="training/classes/classInfo.cfm?id={f2:classes.ID@click}"/>
 </cfif>
0
 
LVL 29

Accepted Solution

by:
Pravin Asar earned 500 total points
ID: 34908802
Here is a simple example for you



<cfajaximport tags="cfform">
<cfajaximport tags="cfwindow">
<cfajaximport tags="cfgrid">
<!--- Define Query --->
<cfset myQuery = QueryNew("ID, Name", "integer, VarChar")>
 
<!--- Add rows in the query --->
<cfset newRow = QueryAddRow(MyQuery, 4)>
 
<!--- Set the values of the cells in the query --->
<cfloop index="ix" from="1" to="4">
<cfset temp = QuerySetCell(myQuery, "ID", ix, ix)>
<cfset temp = QuerySetCell(myQuery, "Name", "Emp Name " & ix, ix)>
</cfloop>

<!--- Create cfform, cgrid, cfinput --->
<!---
Use this a springboard to detect selection in grid, and execute Javascript function
--->
<cfform name="f1" format="html">
<cfgrid format="html"  query="myQuery" bindonload="false" selectonload="false"  name="g1">
<cfgridcolumn  name="ID" header="Emp ID">
<cfgridcolumn  name="Name" header="Emp Name" >
</cfgrid>
<cfinput type="text" name="t1" bindonload="false"  bind="javascript:UpdateWindow({f1:g1.ID@click})"/>
</cfform>

<!--- Create cfwindow, initially hidden --->
<cfwindow  name="cw1"  refreshonshow="true"  modal="false" initshow="false" width="400" height="400"
 source="showUser.cfm?id={f1:g1.ID@click}"/>


<script type="text/javascript">
function UpdateWindow(empid) {
      
      ColdFusion.Window.show('cw1');
}
</script>


My Showuser.cfm is very simple.

<!---- SHOW USER PAGE --->

<cfdump var="#url#"/>
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
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…

739 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