Bind Failed: element not found XXXXXX (CF 9.0.1)

Posted on 2011-02-15
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('') AND 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"
<!--- Training page modal window END--->

Open in new window

Here is the code for the page:
<cfquery name="getMyClasses" datasource="this.DSN">
FROM dbo.Contacts

<cfquery name="checkUserTraining" datasource="this.DSN">
FROM UserTraining
WHERE ContactID = '#getMyClasses.ID#'
AND completed <> 'yes'
<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>
  <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>

<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"  />

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">
FROM dbo.Contacts

<script type="text/javascript">
function ClassDetailWindow(empid2) {'cw2');
<!--- 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"
            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"  />
    <cfinput type="hidden" name="t2" bindonload="false" bind="javascript:ClassDetailWindow({f2:classes.ID@click})"/>

Open in new window

Question by:rrattie
  • 2
LVL 28

Expert Comment

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

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

<cfif isDefined('') AND 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"
LVL 28

Accepted Solution

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

<!--- 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" >
<cfinput type="text" name="t1" bindonload="false"  bind="javascript:UpdateWindow({f1:g1.ID@click})"/>

<!--- Create cfwindow, initially hidden --->
<cfwindow  name="cw1"  refreshonshow="true"  modal="false" initshow="false" width="400" height="400"

<script type="text/javascript">
function UpdateWindow(empid) {

My Showuser.cfm is very simple.

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

<cfdump var="#url#"/>

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

jQuery is a JavaScript library that greatly simplifies JavaScript programming. AJAX is an acronym formed from "Asynchronous JavaScript and XML."  AJAX refers to any communication between client and server, when the human client does not observe a…
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them ( . I did keep the main js functions but made sever…
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…

895 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

13 Experts available now in Live!

Get 1:1 Help Now