Avatar of JohnMac328
JohnMac328
Flag for United States of America asked on

CF - Display records based on other values

The section I am working on is similar to the structure of the referring question.  The section lists the videos that the employees possibly have seen take a test on.  Currently I have all the videos listed no matter what employee is selected.  I was trying to get only the videos to show that they are allowed to test on which is that they have seen it, checked it in and has a test date of null.  Here is the query I am working with

SELECT     Employees.EmployeeID, Detail.VideoID, VideoList.Video_Name, VideoList.NumTests
FROM         Employees INNER JOIN
                      Detail ON Employees.EmployeeID = Detail.EmployeeID INNER JOIN
                      VideoList ON Detail.VideoID = VideoList.VideoID
WHERE Employees.EmployeeID = #val(form.EmployeeID)#

The problem is that WHERE Employees.EmployeeID = #val(form.EmployeeID)# is not diaplaying any videos at all no matter what employee is selected.

Any help is appreciated - I have also included the form
<table class="displayTable">
      <cfform action="AddTestDetails.cfm" method="post" format="html">
      <tr>
        <th>Employee</th>
        <th>Video</th>
        <th>Number of Tests</th>
        <th>Score</th>
     </tr>
      <tr>
        <td><select name="employeeID">
            <cfoutput query="getAllEmployees">
              <option value="#employeeID#">#First_Name##Last_Name#</option>
            </cfoutput>
        </select></td>
        <td width="30"><select name="VideoID" onChange="showNumTests(this.value)">
            <cfoutput query="getAllFilms">
              <option value="#VideoID#">#VideoID# - #Video_Name#</option>
           <cfinput type="hidden" name="employeeID">
			</cfoutput>
        </select></td>
       <td><cfinput type="text" id="NumTests" name="NumTests" size="5"></td>
       <td><cfinput type="text" name="Test_Score" size="5"></td>
      </tr>
      <tr>
        <th>Test Status</th>
        <th>Credits</th>
        <th>Test Date</th>
      </tr>
      <tr>
         <td><select id="status" select name="Test_Status" onChange="updateCredits(this, 'credits');">
            <option value='1'#UserPass#>Passed</option>
            <option value='0'#UserFail#>Fail</option>
        </select></td>
        <td><select id="credits" select name="Credits_Earned">
            <option value='0'>0</option>
            <option value='1'>1</option>
            </select></td> 
            <td><cfinput type="datefield" name="Test_Date"></td>
      </tr>
      <tr>
        <td><input type = "Submit" value = "Submit" name="Submit"></td>
      </tr>
      </cfform>

Open in new window

Web Development SoftwareColdFusion Language

Avatar of undefined
Last Comment
JohnMac328

8/22/2022 - Mon
dgrafx

well - my first thought is that there are no records in one of the tables that match your criteria
open your db manually and look

First find a record from employees where employeeid = your #form.employeeid#
and also there needs to be a record in the detail table where employeeid also = your #form.employeeid#
and also there needs to be a record in videolist table where videoid = the detail table videoid in the same row where the match occurs for employeeid
JohnMac328

ASKER
They have records - if I replace this

#val(form.EmployeeID)#

with EmployeeID = 'mynumber'

it returns the records
dgrafx

ok - so what is your #form.employeeid#?
submit your form and see what the value of it is?
it must not be what you think it is - at the top of your action page put:
<cfdump var="#form#">
<CFABORT>

I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
JohnMac328

ASKER
Ok - it is empty even when I select different names from the drop down.  So it isn't seeing the employeeID
dgrafx

so what is the code for your select box?
you need to add employeeid to it
like:
<select name="employeeid">
<option value="">Select Employee
<cfloop query="myquery">
<option value="#employeeid#">#First_Name##Last_Name#
</cfloop>
</select>

i'm assuming you have something like that

when on your form page - right click to view page source
find the selectbox named employeeid and make sure there are values in it for employeeid - not just the text that shows the name
JohnMac328

ASKER
Here is the select box code - the value is the EMployeeID and I then display the names

        <td><select name="employeeID">
            <cfoutput query="getAllEmployees">
              <option value="#employeeID#">#First_Name##Last_Name#</option>
            </cfoutput>
            </select></td>
âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
dgrafx

what i mean is look at page souce in ie or ff!
then make sure that #employeeid# is an actual value with length
it's possible that employeeid is "" an empty string
JohnMac328

ASKER
Yes - all the employees with there ID's are listed in the source
dgrafx

when you cfdump your form results on action page - do the other form fields have a value as expected?
is it just employeeid that doesn't send a value?
is this a standard form submit? meaning are you using ajax or jquery to submit form? are there any scripts that run when you submit?
Your help has saved me hundreds of hours of internet surfing.
fblack61
JohnMac328

ASKER
All the employees list - the videos do not list.  If I change the query to Select * from Videolist  then I get all the videos listed and I select the employee - then select the video and then post the score, test date etc. and it posts the result to the tables with the correct employeeid-.  I wanted to somehow get just the videos to display based on the employeeid
dgrafx

earlier when i asked what form.employeeid was when you either cfdump your form or just #form.employeeid# you said it was empty!!!
so what did you mean by that?

help me help you - as the saying goes ...

i just looked at your code again - WHY do you have an input type hidden name="employeedid" ???
thats your problem!
JohnMac328

ASKER
Ok - it is confusing.  I took out the hidden field yesterday.  ANd the screen shot show the dump of employeeid as being empty but the select box is full - the source code shows the id's and the video list is empty screen
âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
dgrafx

rename you selectbox to xyz
then refresh form page and submit form cfdumping #form#
see what form.xyz says
JohnMac328

ASKER
It bombs because there is no video to insert into the table

Element VIDEOID is undefined in FORM.  
 
 
The error occurred in C:\Inetpub\wwwroot\Video Library\AddTestDetails.cfm: line 21
 
19 :           (employeeID,VideoID, NumTests, Test_Score, Test_Status, Credits_Earned, Test_Date)
20 :                 VALUES (<cfqueryparam cfsqltype="CF_SQL_INteger"  value="#FORM.employeeID#">,
21 :                         <cfqueryparam cfsqltype="CF_SQL_INteger"  value="#FORM.VideoID#">,
22 :                         <cfqueryparam cfsqltype="CF_SQL_INteger"  value="#FORM.NumTests#">,
23 :                         <cfqueryparam cfsqltype="CF_SQL_INteger"  value="#FORM.Test_Score#">,

 
dgrafx

thats not what i said to do at all!
i said to dump the form
this almost always means you dump then abort BEFORE any code that will error.
testing ya know ...
when you learn to test efficiently - there are not many problems that you can't figure out.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
dgrafx

and btw - WHY is form.videoid not defined???
did you rename videoid or employeeid?

you must have renamed videoid!!!
we are trying to figure out employeeid remember ...
JohnMac328

ASKER
Strange - it does show the id in the dump.  Videoid is not an issue.  It has been there all along and works fine when the videos are listed. screen2
dgrafx

ok - so theres your form.xyz with a value of 10
you must have something going on with employeeid
do a search on your page - not just with your eyes but with your editor and find ALL occurances of employeeid
make sure the only ONE is the selectbox (that you will rename back to employeeid)!
âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
JohnMac328

ASKER
Here is the page - I must not be referring to the correct employeeid
<html>
<head>
<title>Add Video</title>

</head>

<cfif not IsDefined('SESSION.EmployeeID')>
  <cflocation url="login.cfm">
</cfif>

<cfdump var="#form#">

<cfset strMessage = "">
<cfparam name="form.employeeID" default="">

<cfif structKeyExists(FORM, "Submit")>
<CFSET new_date = #CREATEODBCDATETIME(Test_Date)#> 

<cfquery name="AddTestDetails" datasource="#datasource#" result="TestScore">
                INSERT INTO Test
          (employeeID,VideoID, NumTests, Test_Score, Test_Status, Credits_Earned, Test_Date)
                VALUES (<cfqueryparam cfsqltype="CF_SQL_INteger"  value="#FORM.employeeID#">,
                        <cfqueryparam cfsqltype="CF_SQL_INteger"  value="#FORM.VideoID#">,
                        <cfqueryparam cfsqltype="CF_SQL_INteger"  value="#FORM.NumTests#">,
                        <cfqueryparam cfsqltype="CF_SQL_INteger"  value="#FORM.Test_Score#">,
                        <cfqueryparam cfsqltype="CF_SQL_INteger"  value="#FORM.Test_Status#">,
                        <cfqueryparam cfsqltype="CF_SQL_INteger"  value="#FORM.Credits_Earned#">,
                           <cfqueryparam value="#new_date#" cfsqltype="CF_SQL_TIMESTAMP">
                     
                )

        </cfquery>
        
<cfquery name="UpdateEmployeeCredits" datasource="#datasource#">
          UPDATE Employees
SET credits = credits + <cfqueryparam cfsqltype="CF_SQL_INteger"  value="#FORM.Credits_Earned#">
WHERE employeeid = <cfqueryparam cfsqltype="CF_SQL_INteger"  value="#FORM.employeeID#">
 UPDATE Employees
SET paid_credits = credits
WHERE (Credits % 5 = 0)  AND EmployeeID = #val(form.EmployeeID)# 
 </cfquery>
<cfset strMessage = "Test score recorded"> 



</cfif>
	


<cfquery name="getAllEmployees"   datasource="#datasource#">
   SELECT  EmployeeID, First_Name, Last_Name, Email
   FROM    Employees
   WHERE Role < '2'
   ORDER BY First_Name, Last_Name
 </cfquery>
 

<cfquery name="getAllFilms" datasource="#datasource#">
<!---  SELECT     *
 FROM VideoList  ---> 

SELECT     Employees.EmployeeID, Detail.VideoID, VideoList.Video_Name, VideoList.NumTests
FROM        Employees INNER JOIN
            Detail ON Employees.EmployeeID = Detail.EmployeeID INNER JOIN
            VideoList ON Detail.VideoID = VideoList.VideoID
WHERE Employees.EmployeeID = #val(form.EmployeeID)# 

 </cfquery>


<script type="text/javascript">
var arrFilms = [<cfoutput query="getAllFilms">{'videoid':#videoid#, 'NumTests':#NumTests#}<cfif getAllFilms.currentrow LT getAllFilms.recordcount>,</cfif></cfoutput>]; //create an array of objects of video ids and required tests number

var showNumTests = function(vid) {
  for (var i=0; i<arrFilms.length; i++) {
    if (arrFilms[i].videoid == vid) document.getElementById("NumTests").value = arrFilms[i].NumTests;
  }
}
</script>
<script>
//if coldfusion pre-selects an option, this will adjust the credit field when the page loads 
window.onload = function(){
  var updateThisOnload = document.getElementById("status");
  updateCredits(updateThisOnload, "credits");
 }
 
//update credit field based on status field
 function updateCredits(obj, creditFieldId){
  var selectedValue = obj.options[obj.selectedIndex].value;
  var creditField = document.getElementById(creditFieldId);
  
  for(var i = 0; i < creditField.options.length; i++){
   creditField.options[i].selected = (creditField.options[i].value == selectedValue) ? true : false;
  }
  
 }
</script>


<body class="twoColElsLtHdr">

<div id="container">
  <div id="header">
    <img src="images/USGI_Masthead.gif" />
</div>
  <div id="sidebar1">
 <cfif isDefined("SESSION.Role") AND SESSION.Role EQ 0 >
<cfinclude template="sidebar_menuUser.cfm">
<cfelse>
<cfinclude template="sidebar_menuAdmin.cfm">
</cfif>
  </div>
  <div id="mainContent">
    <table class="displayTable">
      <cfform action="AddTestDetails.cfm" method="post" format="html">
      <tr>
        <th>Employee</th>
        <th>Video</th>
        <th>Number of Tests</th>
        <th>Score</th>
     </tr>
      <tr>
        <td><select name="employeeID">
            <cfoutput query="getAllEmployees">
              <option value="#employeeID#">#First_Name##Last_Name#</option>
            </cfoutput>
            </select></td>
        <td width="30"><select name="VideoID" onChange="showNumTests(this.value)">
            <cfoutput query="getAllFilms">
              <option value="#VideoID#">#VideoID# - #Video_Name#</option>
           	</cfoutput>
        </select></td>
       <td><cfinput type="text" id="NumTests" name="NumTests" size="5"></td>
       <td><cfinput type="text" name="Test_Score" size="5"></td>
      </tr>
      <tr>
        <th>Test Status</th>
        <th>Credits</th>
        <th>Test Date</th>
      </tr>
      <tr>
         <td><select id="status" select name="Test_Status" onChange="updateCredits(this, 'credits');">
            <option value='1'#UserPass#>Passed</option>
            <option value='0'#UserFail#>Fail</option>
        </select></td>
        <td><select id="credits" select name="Credits_Earned">
            <option value='0'>0</option>
            <option value='1'>1</option>
            </select></td> 
            <td><cfinput type="datefield" name="Test_Date"></td>
      </tr>
      <tr>
        <td><input type = "Submit" value = "Submit" name="Submit"></td>
      </tr>
      </cfform>
      <tr><td colspan="2"><cfif len(strMessage)><div style="position:relative;left:5px; top:2px;padding:10px; background-color:#FFFFFF;width:250px;color:maroon;text-align:right;">
 <cfoutput>#strMessage#</cfoutput>
 </div>
</cfif></td></tr>
    </table>
  </div>
</div>
</body>
</html>

Open in new window

dgrafx

i see that you are submitting to the same page (form and action pages are the same)
to make it easier to test - break them up into 2 separate pages and don't use and cfparam on the action page
just <cfdump var="#form#"><cfabort> at the top of the action page.
JohnMac328

ASKER
Here is what the dump shows from the new action page
screen3.jpg
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
dgrafx

ok - so far so good ...
now remove the abort and let it insert to db
then right after the db insert query the table to make sure it was inserted ok.
just do
select *
from your table that you insert to
then cfdump that query

i just noticed that you appear to be inserting to "test"
but I don't see you then querying "test"
JohnMac328

ASKER
It crashes because there is no video information to insert -

Element VIDEOID is undefined in FORM.  
 
 
The error occurred in C:\Inetpub\wwwroot\Video Library\AddTestDetailsTESTPAGE.cfm: line 24
 
22 :           (employeeID,VideoID, NumTests, Test_Score, Test_Status, Credits_Earned, Test_Date)
23 :                 VALUES (<cfqueryparam cfsqltype="CF_SQL_INteger"  value="#FORM.employeeID#">,
24 :                         <cfqueryparam cfsqltype="CF_SQL_INteger"  value="#FORM.VideoID#">,
25 :                         <cfqueryparam cfsqltype="CF_SQL_INteger"  value="#FORM.NumTests#">,
26 :                         <cfqueryparam cfsqltype="CF_SQL_INteger"  value="#FORM.Test_Score#">,

 
dgrafx

ok - so where is your form.videoid???
âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
JohnMac328

ASKER
Ok - the videos are not displaying - that is where the videoid, comes from.  If the videos don't display there is no value to insert into the table so the insert query can't complete.
dgrafx

ok - so where are the videos???

you are not supposed to be doing anything differently - just put the updating database stuff on a separate page
JohnMac328

ASKER
I'm not doing anything differently - this issues is why I asked the question in the first place.  I want the videos to display based on what employee is selected.  If the videos don't display they can't be inserted.  Look at screen image1  the video dropdown has no videos in it - it should look like this
screen4.jpg
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
dgrafx

ok - in the beginning you said you werent getting a result and i asked you to open db and look to see that you actually have data for the criteria
you came back and said that if you hard code a value for employeeid then you get a result set!
so we then started in on the experiment trying to find out why your employeeid was an empty string
(does any of this sound familiar?)
i had you move your action code that updates db to a different page to make sure you weren't being affected by default params (cfparam name="xxx" default="")

anyway ...
you implied that you had a result when you ran this query IF you put in your number:
SELECT     Employees.EmployeeID, Detail.VideoID, VideoList.Video_Name, VideoList.NumTests
FROM        Employees INNER JOIN
            Detail ON Employees.EmployeeID = Detail.EmployeeID INNER JOIN
            VideoList ON Detail.VideoID = VideoList.VideoID
WHERE Employees.EmployeeID =  yournumber

so certainly you see that you need to troubleshoot the form.employeeid dont you?

THEN when looking at videoid - what are you trying to do with that script?
remove the onchange event - just for testing - its probably nothing but remove it.

ok now - go to your form page and view the html source from the browser - look at some of the same things that i asked about employeeid but for videoid
JohnMac328

ASKER
What should happen is it displays the video that the employee has seen and taken a test on.  Then the insert records the test results for that test on that video - that is why we need the video id.  What onchange event are you referring to?
dgrafx

look - are you paying attention to what i said?
In the code you posted - you are inserting to a table named TEST - is this accurate or ???
Either way - you need to query the table you are actually inserting to!
You understand that don't you?

And your videoid problem ...
where to begin ???
YOU SAID that when you hard code an employeeid then you get a result set from your query - which then will populate your videoid - you get that don't you?
NOW - WHY don't you have videoid defined on your action page???
Even if there was not a result returned from the query becuse of some employeedid confusion - you would still have an empty string for videoid!
It makes me think you are doing something different than what you are posting here.

A stab in the dark: I don't use <cfform - ever - I use <form
So I don't know if my guess has any merit but is it possible that the cfform is not sending the videoid because it is empty?
STOP THE PRESSES!
I just did a quick test and cfform does NOT send in the field from a selectbox IF the selectbox is empty - that is wierd!!!
In other words it will not be defined in the form scope if the selectbox doesn't have options!

So now we get back to what I've been saying!!!
you need to get on top of this problem!!!
It's EITHER that you are querying/inserting to the WRONG TABLE - look at your code - you are inserting to a table named TEST - I posted that a long time ago - you didn't respond!
OR theres some weird problem with your employeeid???
It's one problem!!!
It's not a bunch of different problems - just a bunch of symptoms from the same problem!

anyway - I had a few moments so thought i'd post

btw: there is generally not a reason to use cfform.
many limitations and rules.
there are only a few usefull cf input tags that require you to be in a cfform - but you really don't need them - you can do the same thing with standard html
AND you can eliminate a stray headache troubleshooting stuff like this
just my opinion ...

âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
_agx_

Guys I haven't read the whole thread in detail.  I can see @dgrafx made some valid points, but to get things going again let me try this from another angle ...

>> I wanted to somehow get just the videos to display based on the employeeid <<

It sounds like you want to create your basic related / dependent select lists. That's certainly possible. But if you want it to happen dynamically (without resubmitting the page) your current code *isn't* going to work. You'll need to add some javascript/ajax. A little like what you're doing with "NumTests" ... but if you're comfortable with cfc's, I'd recommend using a "bind" instead. It's simpler. (Let's skip the "NumTests" update for now. We can add that back once you've got the 1st part working )


First create a cfc/function to grab the videos for a single employeeID. Then use a bind to call that function and update your video list every time an employee is selected. You'll still need to add validation - just in case an employee hasn't seen any videos yet. But that's the jist.


Form (Requires CF 8.0.1 +)
<!--- check your CF version --->
<cfdump var="#server.coldfusion#">

<tr>
   <td><select name="employeeID">
          <cfoutput query="getAllEmployees">
              <option value="#employeeID#">#First_Name##Last_Name#</option>
          </cfoutput>
       </select>
   </td>
   <td width="30"> <cfselect name="VideoID" 
                        bind="cfc:YourComponent.getFilms({employeeID})"
                        value="VideoID" display="Video_Name"
      	                bindOnLoad="true"
                   />
</td>
[code]

[b]YourComponent.cfc[/b]
[code]
<cfcomponent>
   <cffunction name="getFilms" access="remote" returntype="query" output="false">
      <cfargument name="employeeID" type="any" default="0">

      <cfset var getAllFilms = "">
      

      <cfquery name="getAllFilms" datasource="YourDatasourceNameHere">
                   SELECT     Employees.EmployeeID, Detail.VideoID, VideoList.Video_Name, VideoList.NumTests
                   FROM         Employees 
                                INNER JOIN Detail ON Employees.EmployeeID = Detail.EmployeeID 
                                INNER JOIN VideoList ON Detail.VideoID = VideoList.VideoID
                   WHERE Employees.EmployeeID = <cfqueryparam value="#val(arguments.EmployeeID)#" cfsqltype="cf_sql_integer">
       </cfquery>
      <cfreturn getAllFilms>
   </cffunction>
</cfcomponent>

Open in new window



_agx_

Gah ... ignore the scrambled code tags

Form (Requires CF 8.0.1 +)

<!--- check your CF version --->
<cfdump var="#server.coldfusion#">
....
<tr>
   <td><select name="employeeID">
          <cfoutput query="getAllEmployees">
              <option value="#employeeID#">#First_Name##Last_Name#</option>
          </cfoutput>
       </select>
   </td>
   <td width="30"> <cfselect name="VideoID" 
                        bind="cfc:YourComponent.getFilms({employeeID})"
                        value="VideoID" display="Video_Name"
      	                bindOnLoad="true"
                   />
</td>

Open in new window


YourComponent.cfc
<cfcomponent>
   <cffunction name="getFilms" access="remote" returntype="query" output="false">
      <cfargument name="employeeID" type="any" default="0">

      <cfset var getAllFilms = "">
      

      <cfquery name="getAllFilms" datasource="YourDatasourceNameHere">
                   SELECT     Employees.EmployeeID, Detail.VideoID, VideoList.Video_Name, VideoList.NumTests
                   FROM         Employees 
                                INNER JOIN Detail ON Employees.EmployeeID = Detail.EmployeeID 
                                INNER JOIN VideoList ON Detail.VideoID = VideoList.VideoID
                   WHERE Employees.EmployeeID = <cfqueryparam value="#val(arguments.EmployeeID)#" cfsqltype="cf_sql_integer">
       </cfquery>
      <cfreturn getAllFilms>
   </cffunction>
</cfcomponent>

Open in new window

dgrafx

agx
read my last post that starts with "look - are you paying attention to what i said"
look back through the code and you'll see i speak the truth
but now dude isn't responding so he's probably fixed it

btw - i see what you are doing with your select & bind but that not the problem - thats just a different way of doing it - but not the problem
look at my comments regarding a table named test and also at the screen shots he provided
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
JohnMac328

ASKER
agx

I created the component and updated the select boxes but when the page loads it does not display any videos.
JohnMac328

ASKER
I am running CF 9
JohnMac328

ASKER
I made some corrections and now I get this error error
âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
JohnMac328

ASKER
I also commented out showNumTests
JohnMac328

ASKER
I added this but it does not give any more info

http://192.168.1.39/video%20library/AddTestDetails.cfm?cfdebug
_agx_

I made some corrections and now I get this error

@JohnMac328 - I tested the bind with CF9. So ignoring the data for now, I know the code itself works. You said you made some corrections ... maybe that broke something?

1) Test the CFC in your browser. What are the results (success or error)? If it's an error post the error message.
http://yourservername/PathTo/myComponent.cfc?method=getFilms&employeeID=123

2) Also, can you post the current code for your form AND the CFC
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
JohnMac328

ASKER
This gave me the correct information so it does work

http://yourservername/PathTo/myComponent.cfc?method=getFilms&employeeID=123

my correction was correcting the component name in the code :)
Here they are
form code

<html>
<head>
<title>Add Video</title>
<link href="css/formJBMNew.css" rel="stylesheet" type="text/css" />	
</head>

<cfif not IsDefined('SESSION.EmployeeID')>
  <cflocation url="login.cfm">
</cfif>

<cfdump var="#form#">

<cfset strMessage = "">
<cfparam name="form.employeeID" default="">

<cfif structKeyExists(FORM, "Submit")>
<CFSET new_date = #CREATEODBCDATETIME(Test_Date)#> 

<cfquery name="AddTestDetails" datasource="#datasource#" result="TestScore">
                INSERT INTO Test
          (employeeID,VideoID, NumTests, Test_Score, Test_Status, Credits_Earned, Test_Date)
                VALUES (<cfqueryparam cfsqltype="CF_SQL_INteger"  value="#FORM.employeeID#">,
                        <cfqueryparam cfsqltype="CF_SQL_INteger"  value="#FORM.VideoID#">,
                        <cfqueryparam cfsqltype="CF_SQL_INteger"  value="#FORM.NumTests#">,
                        <cfqueryparam cfsqltype="CF_SQL_INteger"  value="#FORM.Test_Score#">,
                        <cfqueryparam cfsqltype="CF_SQL_INteger"  value="#FORM.Test_Status#">,
                        <cfqueryparam cfsqltype="CF_SQL_INteger"  value="#FORM.Credits_Earned#">,
                           <cfqueryparam value="#new_date#" cfsqltype="CF_SQL_TIMESTAMP">
                     
                )

        </cfquery>
        
<cfquery name="UpdateEmployeeCredits" datasource="#datasource#">
          UPDATE Employees
SET credits = credits + <cfqueryparam cfsqltype="CF_SQL_INteger"  value="#FORM.Credits_Earned#">
WHERE employeeid = <cfqueryparam cfsqltype="CF_SQL_INteger"  value="#FORM.employeeID#">
 UPDATE Employees
SET paid_credits = credits
WHERE (Credits % 5 = 0)  AND EmployeeID = #val(form.EmployeeID)# 
 </cfquery>
<cfset strMessage = "Test score recorded"> 



</cfif>
	


<cfquery name="getAllEmployees"   datasource="#datasource#">
   SELECT  EmployeeID, First_Name, Last_Name, Email
   FROM    Employees
   WHERE Role < '2'
   ORDER BY First_Name, Last_Name
 </cfquery>
 

<cfquery name="getAllFilms" datasource="#datasource#">
SELECT     *
 FROM VideoList 

 </cfquery> 


<!--- <script type="text/javascript">
var arrFilms = [<cfoutput query="getAllFilms">{'videoid':#videoid#, 'NumTests':#NumTests#}<cfif getAllFilms.currentrow LT getAllFilms.recordcount>,</cfif></cfoutput>]; //create an array of objects of video ids and required tests number

var showNumTests = function(vid) {
  for (var i=0; i<arrFilms.length; i++) {
    if (arrFilms[i].videoid == vid) document.getElementById("NumTests").value = arrFilms[i].NumTests;
  }
}
</script> --->
<script>
//if coldfusion pre-selects an option, this will adjust the credit field when the page loads 
window.onload = function(){
  var updateThisOnload = document.getElementById("status");
  updateCredits(updateThisOnload, "credits");
 }
 
//update credit field based on status field
 function updateCredits(obj, creditFieldId){
  var selectedValue = obj.options[obj.selectedIndex].value;
  var creditField = document.getElementById(creditFieldId);
  
  for(var i = 0; i < creditField.options.length; i++){
   creditField.options[i].selected = (creditField.options[i].value == selectedValue) ? true : false;
  }
  
 }
</script>


<body class="twoColElsLtHdr">

<div id="container">
  <div id="header">
    <img src="images/USGI_Masthead.gif" />
</div>
  <div id="sidebar1">
 <cfif isDefined("SESSION.Role") AND SESSION.Role EQ 0 >
<cfinclude template="sidebar_menuUser.cfm">
<cfelse>
<cfinclude template="sidebar_menuAdmin.cfm">
</cfif>
  </div>
  <div id="mainContent">
    <table class="displayTable">
      <cfform action="AddTestDetails.cfm" method="post" format="html">
      <tr>
        <th>Employee</th>
        <th>Video</th>
        <th>Number of Tests</th>
        <th>Score</th>
     </tr>
      <tr>
        <td><select name="employeeID">
          <cfoutput query="getAllEmployees">
              <option value="#employeeID#">#First_Name##Last_Name#</option>
          </cfoutput>
       </select>
   </td>
   <td width="30"> <cfselect name="VideoID" 
                        bind="YourComponent.getFilms({employeeID})"
                        value="VideoID" display="Video_Name"
      	                bindOnLoad="true"/>
</td>

       <td><cfinput type="text" id="NumTests" name="NumTests" size="5"></td>
       <td><cfinput type="text" name="Test_Score" size="5"></td>
      </tr>
      <tr>
        <th>Test Status</th>
        <th>Credits</th>
        <th>Test Date</th>
      </tr>
      <tr>
         <td><select id="status" select name="Test_Status" onChange="updateCredits(this, 'credits');">
            <option value='1'#UserPass#>Passed</option>
            <option value='0'#UserFail#>Fail</option>
        </select></td>
        <td><select id="credits" select name="Credits_Earned">
            <option value='0'>0</option>
            <option value='1'>1</option>
            </select></td> 
            <td><cfinput type="datefield" name="Test_Date"></td>
      </tr>
      <tr>
        <td><input type = "Submit" value = "Submit" name="Submit"></td>
      </tr>
      </cfform>
      <tr><td colspan="2"><cfif len(strMessage)><div style="position:relative;left:5px; top:2px;padding:10px; background-color:#FFFFFF;width:250px;color:maroon;text-align:right;">
 <cfoutput>#strMessage#</cfoutput>
 </div>
</cfif></td></tr>
    </table>
  </div>
</div>
</body>
</html>

Open in new window

component

<cfcomponent>
   <cffunction name="getFilms" access="remote" returntype="query" output="false">
      <cfargument name="employeeID" type="any" default="0">

      <cfset var getAllFilms = "">
      

      <cfquery name="getAllFilms" datasource="librarySQL2008">
                   SELECT     Employees.EmployeeID, Detail.VideoID, VideoList.Video_Name, VideoList.NumTests
                   FROM         Employees 
                                INNER JOIN Detail ON Employees.EmployeeID = Detail.EmployeeID 
                                INNER JOIN VideoList ON Detail.VideoID = VideoList.VideoID
                   WHERE Employees.EmployeeID = <cfqueryparam value="#val(arguments.EmployeeID)#" cfsqltype="cf_sql_integer">
       </cfquery>
      <cfreturn getAllFilms>
   </cffunction>
</cfcomponent>

Open in new window

_agx_

@dgrafx - Yeah like I said in my disclaimer, it's a long thread and I didn't read every detail.  I don't doubt you made a lot of valid points. Your approach seemed sound and I agreed with the ones I read.

>> btw - i see what you are doing with your select & bind but that not the problem - thats just a different way of doing it - but not the problem <<

I hear what you're saying. But my take on it is the query/data itself is only one part of the problem. Even if the data and queries were working .. his original code is never going to do what he *seemed* to be asking for originally - related select lists. So it seemed like approaching it from different angle was in order.  Again I'm not disagreeing with a lot of the points you made. But I think there are multiple (related) problems not just one.


_agx_

@JohnMac328

Okay, so
1) does the form now work without error?
2) If yes, does the video list populate with data when you select an employee ?

Btw: Was I correct about your ultimate goal? ie That you want to generate related select lists?
âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
dgrafx

agx - whether or not related selectboxes ...
look at this:
he is inserting to a table named 'test'
he then is querying a different table expecting results to populate the videoid selectbox
do you see what i mean???
JohnMac328

ASKER
I still get the error but the url parameter you gave me displays the correct info.  And yes to the second question.  Test scores are being recorded on a video they saw. When the employee is selected I was hoping to display the videos that they have seen and not yet been tested on so the entire list does not have to be scrolled through to find the correct one.  The error message displays and the video list does not populate.
_agx_

do you see what i mean???

Absolutely. If it's the wrong table it's never going to work.
But .. there's still 2 problems that need to be addressed: 1) the code to generate the selects _and_ 2) the query sql. I think we're agreed on the problems, we're just addressing them in a different order.
Your help has saved me hundreds of hours of internet surfing.
fblack61
_agx_

I still get the error but the url parameter you gave me displays the correct info.

If it works from the URL but not the form, that suggests your <cfselect> code is wrong. I notice yours looks different than my example. The bind seems to be missing the "cfc:" part. Also did you update the path to match your component name and location?

ie
<cfselect name="VideoID"
bind="cfc:pathTo.YourComponent.getFilms({employeeID})" ...>

dgrafx

i've discovered that within a cfform IF you have a cfselect with ZERO options the field will NOT be defined on the action page - test it out.
zero options - not just a zero length value in an option

so his video id is not going to be defined on the action page which causes the error
plus - he is inserting his stuff to the wrong table
i imagine he was testing and never set it back again
_agx_

>> a cfselect with ZERO options the field will NOT be defined <<
Yeah, I tried it and the same happens with an html form. So he's going to need to validate for that condition or ... add just add an empty option "..select a video..." to the list.
âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
JohnMac328

ASKER
The component is in the root with the application.cfm    And I corrected the select box

bind="cfc:YourComponent.getFilms({employeeID})"

I no longer get the error but the video list is empty

dgrafx - the Test table has always been called "Test" since that is where the test results go.
_agx_

I no longer get the error but the video list is empty

That's progress at least. Let's move on to the sql query populating the video list.

Is it *always* empty or just for some employees? Select a different employee from the list, such as employeeID 123. What happens?

dgrafx


agx: yes thats problem #1
then the 2nd problem (no video list) ....

johnmac: right .....

anyway guys - this has been entertaining - but gotta get back to work!
hope ya figure it out!
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
JohnMac328

ASKER
agx

I tried several employees to see if any would give a list and also mine which worked with the url parameter but none would give a list.
_agx_

Thanks! Anyway, I'm about to start *re*-covering the sql stuff I know you mentioned already ;-) so you're timing's good.
_agx_

John,

Hm.. the form shouldn't work any differently than the url. Not unless the <select> list values are different.  Let's go back to something @dgrafx asked earlier.

Run your page and do a "view source" on the form. What do you see for employee <select> list? For my sample form I see

<select name="employeeID">
              <option value="1">JohnSmith</option>
              <option value="2">BobJones</option>
            </select>

Open in new window

âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
JohnMac328

ASKER
Works for me:)
JohnMac328

ASKER
Yes - all the employees are listed in the source just like your example
_agx_

What about the select list "value"? In other words, if the html shows employeeID=1:
      <option value="1">JohnSmith</option>

... and viewing it via url returns results
http://yourservername/PathTo/myComponent.cfc?method=getFilms&employeeID=1

... then logically the form bind *must* return the same results. If not, then something is wrong that I can't see ;-) Can you enable ajax debugging and select an employee, then post a screen shot. Notice how mine shows employeeID=2.




bindDump.jpg
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
JohnMac328

ASKER
I enabled debugging and select employees but no screen shows up.  I made sure to add the IP of the server to the list in the CF Admin
_agx_

Make sure you add ?"cfdebug" to the url

http://127.0.0.1:8501/test/mytestPage.cfm?cfdebug
JohnMac328

ASKER
Here is what I am using - do I have to restart CF?

http://192.168.1.39/video%20library/AddTestDetails.cfm?cfdebug
âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
_agx_

No, that option takes effect without a restart. Maybe it's your ip filtering?

The ajax logger is better, but a simple hack would be to write the selected employeeID to your application log. Just add a <cflog> call inside your CFC.

	
<cffunction name="getFilms" access="remote" returntype="query" output="false">
    <cfargument name="employeeID" type="any" required="false" default="0">
    <cfset var getAllFilms = "">
		
     <cflog application="true" text="Selected employeeID [#arguments.employeeID#] at #now()#">
....

Open in new window


I'm still stuck on why you're getting different results with what should be the same code. I know you need to obfuscate the data :) but either your code is different *or* there's a problem somewhere in the data .. but I can't see it ;-)
JohnMac328

ASKER
I tried it in Firefox and got the pop up of "Bind failed...." which I submitted a image of before.  Still no ajax window
_agx_

You may want to forget about the logger for now. It's a "nice to have" feature. But like I said, a simple hack is to just write the info to your application log and check it manually.

We need to find out _what_ value is being sent to your CFC .. because let's face it. Logically there's just no way these 2 should return different results ;-)

employeeID=1 called via bind
<cfselect bind="cfc:PathTo.myComponent.getFilms(1)"...>

employeeID=1 called via url
http://yourservername/PathTo/myComponent.cfc?method=getFilms&employeeID=1

The same url called with the same employee ID has to return the same results.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
JohnMac328

ASKER
I know, the other sections that work similar have no problem.  I still do not get a ajax screen to come up.  Must be something.  Just for the heck of it here is the page that checks out videos which works fine.  What it does is only display videos that they have not seen so they can't take it out again and test on it.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/formJBMNew.css" rel="stylesheet" type="text/css" />	


<cfif not IsDefined('SESSION.EmployeeID')>
  <cflocation url="login.cfm">
</cfif>
<cfset strMessage = "">

<cfparam name="form.employeeID" default="">

 <cfquery name="getAllEmployees" datasource="#datasource#">

 SELECT  Employees.EmployeeID, Employees.Last_name, Employees.First_name, Email
FROM    Employees LEFT JOIN 
      (     SELECT EmployeeID, COUNT(*) AS TotalNotCheckedIn
            FROM   Detail
            WHERE  out_date IS NOT NULL 
            AND    In_Date IS NULL
            GROUP BY EmployeeID
            HAVING COUNT(*) > 1
        ) 
        mx ON Employees.EmployeeID = mx.EmployeeID
WHERE   mx.EmployeeID IS NULL and Role <> '2'
ORDER BY First_Name, Last_Name
 </cfquery>


<cfif structKeyExists(FORM, "submitButton")>

<CFSET new_date = #CREATEODBCDATETIME(Out_Date)#>

  
 
  <cfquery name="enterdetails" datasource="#datasource#">
    INSERT INTO Detail (EmployeeID, VideoID, Out_Date)
    VALUES
    (
        <cfqueryparam value="#form.employeeID#" cfsqltype="cf_sql_integer"> ,
        <cfqueryparam value="#form.VideoID#" cfsqltype="cf_sql_integer"> ,
         <cfqueryparam value="#new_date#" cfsqltype="CF_SQL_TIMESTAMP">
    )
  </cfquery>
<cfset strMessage = "Video checked out"> 

<cfquery datasource="#datasource#">
   update VideoList
set Availability = '0'
    WHERE VideoID = #val(form.VideoID)# 
</cfquery>
</cfif>

  
<cfquery name="getAllFilms" datasource="#datasource#">

 SELECT     v.VideoID, v.Video_Name, v.Length, v.Production_Company, c.Category_Name, v.Credits, c.Category_ID, v.Availability
FROM         Category AS c INNER JOIN
                      VideoList AS v ON c.Category_ID = v.CategoryID
WHERE     (v.VideoID NOT IN
                          (SELECT     VideoID
                            FROM          Detail
                            WHERE      (ISNULL(Watched, 0) = - 1) AND (EmployeeID = '#session.EmployeeID#'))) AND (v.Availability <> 2)
ORDER BY v.VideoID
  </cfquery>
 
<body class="twoColElsLtHdr">

<div id="container">
  <div id="header">
    <img src="images/USGI_Masthead.gif" />
  <!-- end #header -->
  </div>
  <div id="sidebar1">
<cfif isDefined("SESSION.Role") AND SESSION.Role EQ 0 >
		<cfinclude template="sidebar_menuUser.cfm">
<cfelse>
		<cfinclude template="sidebar_menuAdmin.cfm">
</cfif>
</div>

  <div id="mainContent">

<table class="displayTable">
    <caption>Displays employees eligible to check out videos.</caption>
 <tr>
	<th>Employee</th>
    
    <th>Video</th>
    <th>Date</th>
</tr>
<cfform action="videoCheckout.cfm" method="post" format="html">
		<tr>
        <td>
      <cfselect name="employeeID">
          <cfoutput query="getAllEmployees">
             <option value="#employeeID#">#First_Name##Last_Name#</option>
          </cfoutput></cfselect></td>
      <td>
      <cfselect name="VideoID">
          <cfoutput query="getAllFilms">
              <option value="#VideoID#">#VideoID# - #Video_Name#</option>
           </cfoutput>
          </cfselect></td>
  <td><cfinput type="datefield" name="Out_Date" required="yes" message="Please enter check-out date"></td></tr>   
<tr><td><cfinput type="submit" name="submitButton"  value="Submit"></td></tr>
</cfform>
<td colspan="2"><cfif len(strMessage)><div style="position:relative;left:5px; top:2px;padding:10px; background-color:#FFFFFF;width:250px;color:maroon;text-align:right;">
 <cfoutput>#strMessage#</cfoutput>
 </div>
</cfif></td>
</table>



</div>
</div>
</body>
</html>

Open in new window

_agx_

I still do not get a ajax screen to come up.

Well, then like I said forget about the ajax logger. You can just add that 1 line to your CFC and it'll write the info we need to your c:\coldfusion9\logs\application.log.
JohnMac328

ASKER
Here is the last few min from the log.  It is displaying the employees that I am selecting from the drop down
"Information","jrpp-33","05/27/11","11:17:34","USGI_VIDEO_LIBRARY","Selected employeeID [145] at {ts '2011-05-27 11:17:34'}"
"Information","jrpp-35","05/27/11","11:55:41","USGI_VIDEO_LIBRARY","Selected employeeID [10] at {ts '2011-05-27 11:55:41'}"
"Information","jrpp-35","05/27/11","11:56:28","USGI_VIDEO_LIBRARY","Selected employeeID [145] at {ts '2011-05-27 11:56:28'}"

Open in new window

âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
JohnMac328

ASKER
This is from running the url parameter which shows several videos associated with id of 10

"Information","jrpp-35","05/27/11","11:58:26","USGI_VIDEO_LIBRARY","Selected employeeID [10] at {ts '2011-05-27 11:58:26'}"
_agx_

Okay, I'm officially confused :)  

You're saying if you select employeeID=145 from the form list it *doesn't* return any videos ... but if you use that same employeeID in a url it *does* return videos?
ie
http://yourservername/PathTo/myComponent.cfc?method=getFilms&employeeID=145

I don't see any way that could happen, unless you're using different code than what you posted.
JohnMac328

ASKER
Exactly and Yes  I am also confused.  Code is right from the pages on the site.  Must be something with the dropdown of video since that is the only difference between the two.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
_agx_

1) Are you using the *exact* code shown in http:#a35861650 ?

2) Add 1 more debugging line to the CFC. So we can see how many records are returned. Then a) select employeeID=145 from the list b) AND view employeeID=145 from the url. What are the results from the log?

<cffunction name="getFilms" access="remote" returntype="query" output="false">
          .... etc.... 
       <cfquery ...>
         ....
       </cfquery>
        <cflog application="true" text="RecordCount [#getAllFilms.recordCount#] for selected employeeID [#arguments.employeeID#] at #now()#">

		<cfreturn getAllFilms>
	</cffunction>
</cfcomponent>

Open in new window

JohnMac328

ASKER
Yes same code except I took out the

<cfquery name="getAllFilms" datasource="#datasource#">
SELECT     *
 FROM VideoList

 </cfquery>

I took it out and put it back in several times to see if it would make a difference.

<em>Add 1 more debugging line to the CFC. So we can see how many records are returned. </em>

What would the syntax be?



_agx_

Just add another <cflog> call (see line#9). Here's a copy of mine without the test sql


	<cffunction name="getFilms" access="remote" returntype="query" output="false">
		<cfargument name="employeeID" type="any" required="false" default="0">
		<cfset var getAllFilms = "">
		
		<cflog application="true" text="Selected employeeID [#arguments.employeeID#] at #now()#">
		
		<cfquery name="getAllFilms" ....> run the query </cfquery>

		<cflog application="true" text="RecordCount [#getAllFilms.recordCount#] for selected employeeID [#arguments.employeeID#] at #now()#">

		<cfreturn getAllFilms>
	</cffunction>

Open in new window

âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
JohnMac328

ASKER
This is new screen 2
_agx_

<cflog application="true" text="RecordCount [#getAllFilms.recordCount#] for selected employeeID [#arguments.employeeID#] at #now()#">

Adding that one line shouldn't cause that. Mine works without error. What does your cfc code look like?
JohnMac328

ASKER
I added this line and when I take it out the error does not display

<cflog application="true" text="RecordCount [#getAllFilms.recordCount#] at #now()#">

Open in new window

I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
JohnMac328

ASKER
I tried it with this too - same error

<cflog application="true" text="RecordCount [#getAllFilms.recordCount#] for selected employeeID [#arguments.employeeID#] at #now()#">
_agx_

I tried it and it won't cause an error unless it's in put in the wrong place (like before the query even executes.

But .. that's also not the same code as what I posted.  Let's try and make sure we're both using the exact *same* code (when possible). Otherwise we'll be introducing entirely new problems all over the place ...and this will take even longer to solve ;-)

Here's my exact CFC function again, minus my test query
	<cffunction name="getFilms" access="remote" returntype="query" output="false">
		<cfargument name="employeeID" type="any" required="false" default="0">
		<cfset var getAllFilms = "">
		
		<cflog application="true" text="Selected employeeID [#arguments.employeeID#] at #now()#">
		
		<cfquery name="getAllFilms" ....> run the query </cfquery>

		<cflog application="true" text="RecordCount [#getAllFilms.recordCount#] for selected employeeID [#arguments.employeeID#] at #now()#">

		<cfreturn getAllFilms>
	</cffunction>

Open in new window

JohnMac328

ASKER
Have to go to a meeting - I will check back in a hour.  Looks like I may have something wrong with CF java
âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
_agx_

ooops our posts crossed.  

You'll have to post your whole cffunction, because like I said - the code is tested and works fine for me. So yours *must* be different.
JohnMac328

ASKER
I had a mistake - I will run the test queries when I get back
_agx_

Ok. Too bad your ajax debugger (or ip filtering) isn't working right. Because this is exactly what it's designed for. For dev servers, I'd just skip IP filtering and enable everything. But I don't know if you're on a DEV server or not.
Your help has saved me hundreds of hours of internet surfing.
fblack61
JohnMac328

ASKER
It's a DEV server and I can't find where to turn off IP filtering
JohnMac328

ASKER
Through the param query and through the form the log files are identical returning records


"Information","jrpp-38","05/27/11","13:00:03","USGI_VIDEO_LIBRARY","RecordCount [342] for selected employeeID [10] at {ts '2011-05-27 13:00:03'}"
"Information","jrpp-41","05/27/11","14:12:52","USGI_VIDEO_LIBRARY","Selected employeeID [10] at {ts '2011-05-27 14:12:52'}"
"Information","jrpp-41","05/27/11","14:12:52","USGI_VIDEO_LIBRARY","RecordCount [342] for selected employeeID [10] at {ts '2011-05-27 14:12:52'}"
"Information","jrpp-41","05/27/11","14:13:01","USGI_VIDEO_LIBRARY","Selected employeeID [10] at {ts '2011-05-27 14:13:01'}"
"Information","jrpp-41","05/27/11","14:13:01","USGI_VIDEO_LIBRARY","RecordCount [342] for selected employeeID [10] at {ts '2011-05-27 14:13:01'}"
"Information","jrpp-41","05/27/11","14:13:59","USGI_VIDEO_LIBRARY","Selected employeeID [145] at {ts '2011-05-27 14:13:59'}"
"Information","jrpp-41","05/27/11","14:13:59","USGI_VIDEO_LIBRARY","RecordCount [9] for selected employeeID [145] at {ts '2011-05-27 14:13:59'}"

Open in new window

_agx_

For DEV servers I just check everything under:  Debug Output Settings
For IP Filtering see: Debugging & Logging > Debugging IP Addresses

Through the param query and through the form the log files are identical returning records

Then it seems impossible that the video list isn't populating. Are you getting any javascript errors? Check the error console in FF.

âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
JohnMac328

ASKER
IE gives this

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6.6; SU 3.95; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727; WWTClient2; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)
Timestamp: Fri, 27 May 2011 19:24:02 UTC


Message: Exception thrown and not caught
Line: 803
Char: 1
Code: 0
URI: http://192.168.1.39/CFIDE/scripts/ajax/package/cfajax.js

JohnMac328

ASKER
Here is what FF gives - looks like it can't find employeeid which makes no sense screen3
_agx_

Yeah that doesn't make sense.

I hate to keep asking this but are you 100% sure you're running the same code you posted? Because  I can run the same basic code that I posted yesterday, and have no problems at all.

This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
_agx_

I even took your code from http:#a35861650 and aside from using dummy queries, it works fine "as is".  Unless I'm missing something, everything keeps indicating you're using differentcode than what's posted here .. and we're just going in circles ;-)

MyFormPage.cfm
<!--- FAKE query for testing ...--->
<cfquery name="getAllEmployees"   datasource="#datasource#">
	SELECT 1 AS EmployeeID, 'John' AS First_name, 'Smith' AS Last_Name, 'j1@com.com' AS Email UNION
	SELECT 2 AS EmployeeID, 'Bob' AS First_name, 'Jones' AS Last_Name, 'j2@com.com' AS Email 
</cfquery>
<body class="twoColElsLtHdr">

<div id="container">
  <div id="header">
    <img src="images/USGI_Masthead.gif" />
</div>
  <div id="sidebar1">
  </div>
  <div id="mainContent">
    <table class="displayTable">
      <cfform action="AddTestDetails.cfm" method="post" format="html">
      <tr>
        <th>Employee</th>
        <th>Video</th>
        <th>Number of Tests</th>
        <th>Score</th>
     </tr>
      <tr>
        <td><select name="employeeID">
          <cfoutput query="getAllEmployees">
              <option value="#employeeID#">#First_Name##Last_Name#</option>
          </cfoutput>
       </select>
   </td>
   <td width="30"> <cfselect name="VideoID" 
                        bind="cfc:MyComponent.getFilms({employeeID})"
                        value="VideoID" display="Video_Name"
      	                bindOnLoad="true"/>
</td>

       <td><cfinput type="text" id="NumTests" name="NumTests" size="5"></td>
       <td><cfinput type="text" name="Test_Score" size="5"></td>
      </tr>
      <tr>
        <th>Test Status</th>
        <th>Credits</th>
        <th>Test Date</th>
      </tr>
      <tr>
         <td><select id="status" select name="Test_Status" onChange="updateCredits(this, 'credits');">
            <option value='1'#UserPass#>Passed</option>
            <option value='0'#UserFail#>Fail</option>
        </select></td>
        <td><select id="credits" select name="Credits_Earned">
            <option value='0'>0</option>
            <option value='1'>1</option>
            </select></td> 
            <td><cfinput type="datefield" name="Test_Date"></td>
      </tr>
      <tr>
        <td><input type = "Submit" value = "Submit" name="Submit"></td>
      </tr>
      </cfform>
      <tr><td colspan="2"><cfif len(strMessage)><div style="position:relative;left:5px; top:2px;padding:10px; background-color:#FFFFFF;width:250px;color:maroon;text-align:right;">
 <cfoutput>#strMessage#</cfoutput>
 </div>
</cfif></td></tr>
    </table>
  </div>
</div>
</body>

Open in new window


MyComponent.cfc (create both files the same directory )
<cfcomponent>
	<cfset datasource = "My Datasource Name Here">
	<cffunction name="getFilms" access="remote" returntype="query" output="false">
		<cfargument name="employeeID" type="any" required="false" default="0">
		<cfset var getAllFilms = "">
		
		<cflog application="true" text="Selected employeeID [#arguments.employeeID#] at #now()#">
		
                <!--- FAKE query for testing ...--->
		<cfquery name="getAllFilms" datasource="#datasource#">
	    	SELECT 0 AS EmployeeID, 0 AS VideoID, 'Selected EmployeeID #arguments.employeeID#' AS Video_Name, 0 AS NumTests UNION
			SELECT 1 AS EmployeeID, 3 AS VideoID, 'Video 32' AS Video_Name, 0 AS NumTests UNION
			SELECT 2 AS EmployeeID, 3 AS VideoID, 'Video 31' AS Video_Name, 0 AS NumTests 
 		</cfquery>

		<cflog application="true" text="RecordCount [#getAllFilms.recordCount#] at #now()#">

		<cfreturn getAllFilms>
	</cffunction>
</cfcomponent>

Open in new window

JohnMac328

ASKER
I get the same error with your code, the not finding employeeid with FF.  I copied both your examples.
_agx_

And you copied the code exactly? Both files in the same directory. You didn't add any code, change the file names, nothing. You're getting errors with *exactly* what's posted above? If yes, then ... I'm totally at a loss :/  



âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
_agx_

And you copied the code exactly? ... You didn't add any code

... other than substituting your datasource name for the cfquery's obviously.

-->
<cfquery name="getAllEmployees"   datasource="#datasource#">
<cfset datasource = "My Datasource Name Here">
JohnMac328

ASKER
Yes just the stuff to make it run -

<cfset datasource = "My Datasource Name Here">

I even did this to give it an ID to start from but did not work

<cfparam name="form.employeeID" default="10">
JohnMac328

ASKER
But if I go back to this and revert my select boxes to the old ones everything works without the filter

<cfquery name="getAllFilms" datasource="#datasource#">
SELECT     *
 FROM VideoList
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
_agx_

I even did this to give it an ID to start from but did not work
<cfparam name="form.employeeID" default="10">


Well, I'm not sure why. That variable's not used anywhere in the code sample.

Unfortunately I'm out of ideas on this :/  All of the samples I've posted work *perfectly* on my CF9 box "as is".  So at this point, it seems like the problem must be in your environment only. Maybe a problematic Application.cfc ...?  If binding isn't working in your environment, you could always just re-submit the form OR load up the videos into an array like you were doing with "NumTests".  It's klunky but at this point we're running out of options..
JohnMac328

ASKER
I appreciate all your help - I amy take it home and see if I can recreate it there.  Have a great weekend
JohnMac328

ASKER
agx - just a FYI.  I moved everything to my local machine including my local SQL 2008, CF files and CF admin.  The only change now is I get the AJAX Logger window to come up.  It shows the list of videos that goes with the selected employee like it should but only in the debug window.  Very strange
âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
_agx_

Are you still getting the javascript error? All very weird.. The sample code's so basic, I can't see how it'd go wrong. Maybe something's messed up in your CF configuration? Try it on a totally clean install. Don't copy over the CF Admin stuff though, because that might be masking the problem...
JohnMac328

ASKER
What I meant by CF admin was it is my local Coldfusion 8.0 and not the one on the server.  FF gives this error log but IE still displays the correct video data with the employee.  Crazy stuff
info:http: CFC invocation response: {"COLUMNS":["EMPLOYEEID","VIDEOID","VIDEO_NAME","NUMTESTS"],"DATA":[]}

window:global: _1d3 is undefined (http://localhost/CFIDE/scripts/ajax/package/cfcalendar.js, line 43)

info:http: HTTP GET /CF_Library_TestSQL/Yourcomponent.cfc?method=getFilms&returnFormat=json&argumentCollection=%7B%22employeeID%22%3Anull%7D&_cf_nodebug=true&_cf_nocache=true&_cf_clientid=2C0237E046853F41B3C576B25A1CF480&_cf_rc=0

info:http: Invoking CFC: /CF_Library_TestSQL/Yourcomponent.cfc , function: getFilms , arguments: {"employeeID":null}

error:bind: Element not found: employeeID

error:bind: Bind failed, element not found: employeeID

info:LogReader: LogReader initialized

info:global: Logger initialized

Open in new window

_agx_

Are you running different versions of CF (locally CF8 / dev server CF9)? I tested with CF9 only. I've no idea if there are any differences in CF8.  From the js error I can see the bind isn't working.
- Can you post the generated html of the sample form?
- Do *any* binds work on your server?


Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
JohnMac328

ASKER
The server is 9 and my local copy is 8.  Here is what the AJAX logger gives for your example
info:http: CFC invocation response: {"COLUMNS":["EMPLOYEEID","VIDEOID","VIDEO_NAME","NUMTESTS"],"DATA":[[0,0,"Selected EmployeeID null",0],[1,3,"Video 32",0],[2,3,"Video 31",0]]}

window:global: _1d3 is undefined (http://localhost/CFIDE/scripts/ajax/package/cfcalendar.js, line 43)

info:http: HTTP GET /CF_Library_TestSQL/MyComponent.cfc?method=getFilms&returnFormat=json&argumentCollection=%7B%22employeeID%22%3Anull%7D&_cf_nodebug=true&_cf_nocache=true&_cf_clientid=2C0237E046853F41B3C576B25A1CF480&_cf_rc=0

info:http: Invoking CFC: /CF_Library_TestSQL/MyComponent.cfc , function: getFilms , arguments: {"employeeID":null}

error:bind: Element not found: employeeID

error:bind: Bind failed, element not found: employeeID

info:LogReader: LogReader initialized

info:global: Logger initialized

Open in new window

_agx_

The server is 9 and my local copy is 8.

Always use the same for both, if at all possible. Because all sorts of things work differently under CF9 vs CF8. Obviously some don't work under 8 at all.

Here is what the AJAX logger gives for your example
No, I mean the generated html of the sample page ie Do a view source and paste the entire output.

window:global: _1d3 is undefined (http://localhost/CFIDE/scripts/ajax/package/cfcalendar.js, line 43)

I'm not sure, do those work in CF8? Any change if you comment out the cfinput datefield?
JohnMac328

ASKER
Did not make a difference taking out the datefield.  Here is the view source
<!-- If index.cfm?logout=1 is clicked then Log The User Out -->
  <html>
<head><script type="text/javascript">_cf_loadingtexthtml="<div align='center'><img src='/CFIDE/scripts/ajax/resources/cf/images/loading.gif'/>";
_cf_contextpath="";
_cf_ajaxscriptsrc="/CFIDE/scripts/ajax";
_cf_jsonprefix='//';
_cf_clientid='2C0237E046853F41B3C576B25A1CF480';</script><script type="text/javascript" src="/CFIDE/scripts/ajax/yui/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/ajax/yui/dragdrop/dragdrop-min.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/ajax/yui/logger/logger-min.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/ajax/dump/dump.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/ajax/messages/cfmessage.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/ajax/package/cfajax.js"></script>

<script type="text/javascript" src="/CFIDE/scripts/cfform.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/masks.js"></script>

<title>Add Video</title>
<link href="css/formJBMNew.css" rel="stylesheet" type="text/css" />	
<link rel="stylesheet" type="text/css" href="/CFIDE/scripts/ajax/yui/logger/assets/logger.css" />

<style>.yui-log .debug {background-color:brown}
</style>
<script type="text/javascript">
	ColdFusion.Ajax.initSelect('VideoID','VIDEOID','VIDEO_NAME');
</script>

<script type="text/javascript">
	_cf_bind_init_1306860051204=function()
	{
		ColdFusion.Bind.register([['employeeID','CFForm_1','change']],{'bindTo':'VideoID','bindToAttr':'value','cfc':'/CF_Library_TestSQL/Yourcomponent.cfc','cfcFunction':'getFilms','bindExpr':[['employeeID','employeeID','CFForm_1','value']]},ColdFusion.Bind.cfcBindHandler,true);
	};ColdFusion.Event.registerOnLoad(_cf_bind_init_1306860051204);
</script>

<script type="text/javascript">
<!--
    _CF_checkCFForm_1 = function(_CF_this)
    {
        //reset on submit
        _CF_error_exists = false;
        _CF_error_messages = new Array();
        _CF_error_fields = new Object();
        _CF_FirstErrorField = null;


        //display error messages and return success
        if( _CF_error_exists )
        {
            if( _CF_error_messages.length > 0 )
            {
                // show alert() message
                _CF_onErrorAlert(_CF_error_messages);
                // set focus to first form error, if the field supports js focus().
                if( _CF_this[_CF_FirstErrorField].type == "text" )
                { _CF_this[_CF_FirstErrorField].focus(); }

            }
            return false;
        }else {
            return true;
        }
    }
//-->
</script>
</head>

<style>


	table.cfdump_wddx,
	table.cfdump_xml,
	table.cfdump_struct,
	table.cfdump_array,
	table.cfdump_query,
	table.cfdump_cfc,
	table.cfdump_object,
	table.cfdump_binary,
	table.cfdump_udf,
	table.cfdump_udfbody,
	table.cfdump_udfarguments {
		font-size: xx-small;
		font-family: verdana, arial, helvetica, sans-serif;
		cell-spacing: 2px;
	}

	table.cfdump_wddx th,
	table.cfdump_xml th,
	table.cfdump_struct th,
	table.cfdump_array th,
	table.cfdump_query th,
	table.cfdump_cfc th,
	table.cfdump_object th,
	table.cfdump_binary th,
	table.cfdump_udf th,
	table.cfdump_udfbody th,
	table.cfdump_udfarguments th {
		text-align: left;
		color: white;
		padding: 5px;
	}

	table.cfdump_wddx td,
	table.cfdump_xml td,
	table.cfdump_struct td,
	table.cfdump_array td,
	table.cfdump_query td,
	table.cfdump_cfc td,
	table.cfdump_object td,
	table.cfdump_binary td,
	table.cfdump_udf td,
	table.cfdump_udfbody td,
	table.cfdump_udfarguments td {
		padding: 3px;
		background-color: #ffffff;
		vertical-align : top;
	}

	table.cfdump_wddx {
		background-color: #000000;
	}
	table.cfdump_wddx th.wddx {
		background-color: #444444;
	}


	table.cfdump_xml {
		background-color: #888888;
	}
	table.cfdump_xml th.xml {
		background-color: #aaaaaa;
	}
	table.cfdump_xml td.xml {
		background-color: #dddddd;
	}

	table.cfdump_struct {
		background-color: #0000cc ;
	}
	table.cfdump_struct th.struct {
		background-color: #4444cc ;
	}
	table.cfdump_struct td.struct {
		background-color: #ccddff;
	}

	table.cfdump_array {
		background-color: #006600 ;
	}
	table.cfdump_array th.array {
		background-color: #009900 ;
	}
	table.cfdump_array td.array {
		background-color: #ccffcc ;
	}

	table.cfdump_query {
		background-color: #884488 ;
	}
	table.cfdump_query th.query {
		background-color: #aa66aa ;
	}
	table.cfdump_query td.query {
		background-color: #ffddff ;
	}


	table.cfdump_cfc {
		background-color: #ff0000;
	}
	table.cfdump_cfc th.cfc{
		background-color: #ff4444;
	}
	table.cfdump_cfc td.cfc {
		background-color: #ffcccc;
	}


	table.cfdump_object {
		background-color : #ff0000;
	}
	table.cfdump_object th.object{
		background-color: #ff4444;
	}

	table.cfdump_binary {
		background-color : #eebb00;
	}
	table.cfdump_binary th.binary {
		background-color: #ffcc44;
	}
	table.cfdump_binary td {
		font-size: x-small;
	}
	table.cfdump_udf {
		background-color: #aa4400;
	}
	table.cfdump_udf th.udf {
		background-color: #cc6600;
	}
	table.cfdump_udfarguments {
		background-color: #dddddd;
		cell-spacing: 3;
	}
	table.cfdump_udfarguments th {
		background-color: #eeeeee;
		color: #000000;
	}

</style> <script language="javascript">


// for queries we have more than one td element to collapse/expand
	var expand = "open";

	dump = function( obj ) {
		var out = "" ;
		if ( typeof obj == "object" ) {
			for ( key in obj ) {
				if ( typeof obj[key] != "function" ) out += key + ': ' + obj[key] + '<br>' ;
			}
		}
	}


	cfdump_toggleRow = function(source) {
		//target is the right cell
		if(document.all) target = source.parentElement.cells[1];
		else {
			var element = null;
			var vLen = source.parentNode.childNodes.length;
			for(var i=vLen-1;i>0;i--){
				if(source.parentNode.childNodes[i].nodeType == 1){
					element = source.parentNode.childNodes[i];
					break;
				}
			}
			if(element == null)
				target = source.parentNode.lastChild;
			else
				target = element;
		}
		//target = source.parentNode.lastChild ;
		cfdump_toggleTarget( target, cfdump_toggleSource( source ) ) ;
	}

	cfdump_toggleXmlDoc = function(source) {

		var caption = source.innerHTML.split( ' [' ) ;

		// toggle source (header)
		if ( source.style.fontStyle == 'italic' ) {
			// closed -> short
			source.style.fontStyle = 'normal' ;
			source.innerHTML = caption[0] + ' [short version]' ;
			source.title = 'click to maximize' ;
			switchLongToState = 'closed' ;
			switchShortToState = 'open' ;
		} else if ( source.innerHTML.indexOf('[short version]') != -1 ) {
			// short -> full
			source.innerHTML = caption[0] + ' [long version]' ;
			source.title = 'click to collapse' ;
			switchLongToState = 'open' ;
			switchShortToState = 'closed' ;
		} else {
			// full -> closed
			source.style.fontStyle = 'italic' ;
			source.title = 'click to expand' ;
			source.innerHTML = caption[0] ;
			switchLongToState = 'closed' ;
			switchShortToState = 'closed' ;
		}

		// Toggle the target (everething below the header row).
		// First two rows are XMLComment and XMLRoot - they are part
		// of the long dump, the rest are direct children - part of the
		// short dump
		if(document.all) {
			var table = source.parentElement.parentElement ;
			for ( var i = 1; i < table.rows.length; i++ ) {
				target = table.rows[i] ;
				if ( i < 3 ) cfdump_toggleTarget( target, switchLongToState ) ;
				else cfdump_toggleTarget( target, switchShortToState ) ;
			}
		}
		else {
			var table = source.parentNode.parentNode ;
			var row = 1;
			for ( var i = 1; i < table.childNodes.length; i++ ) {
				target = table.childNodes[i] ;
				if( target.style ) {
					if ( row < 3 ) {
						cfdump_toggleTarget( target, switchLongToState ) ;
					} else {
						cfdump_toggleTarget( target, switchShortToState ) ;
					}
					row++;
				}
			}
		}
	}

	cfdump_toggleTable = function(source) {

		var switchToState = cfdump_toggleSource( source ) ;
		if(document.all) {
			var table = source.parentElement.parentElement ;
			for ( var i = 1; i < table.rows.length; i++ ) {
				target = table.rows[i] ;
				cfdump_toggleTarget( target, switchToState ) ;
			}
		}
		else {
			var table = source.parentNode.parentNode ;
			for ( var i = 1; i < table.childNodes.length; i++ ) {
				target = table.childNodes[i] ;
				if(target.style) {
					cfdump_toggleTarget( target, switchToState ) ;
				}
			}
		}
	}

	cfdump_toggleSource = function( source ) {
		if ( source.style.fontStyle == 'italic' || source.style.fontStyle == null) {
			source.style.fontStyle = 'normal' ;
			source.title = 'click to collapse' ;
			return 'open' ;
		} else {
			source.style.fontStyle = 'italic' ;
			source.title = 'click to expand' ;
			return 'closed' ;
		}
	}

	cfdump_toggleTarget = function( target, switchToState ) {
		if ( switchToState == 'open' )	target.style.display = '' ;
		else target.style.display = 'none' ;
	}

	// collapse all td elements for queries
	cfdump_toggleRow_qry = function(source) {
		expand = (source.title == "click to collapse") ? "closed" : "open";
		if(document.all) {
			var nbrChildren = source.parentElement.cells.length;
			if(nbrChildren > 1){
				for(i=nbrChildren-1;i>0;i--){
					target = source.parentElement.cells[i];
					cfdump_toggleTarget( target,expand ) ;
					cfdump_toggleSource_qry(source);
				}
			}
			else {
				//target is the right cell
				target = source.parentElement.cells[1];
				cfdump_toggleTarget( target, cfdump_toggleSource( source ) ) ;
			}
		}
		else{
			var target = null;
			var vLen = source.parentNode.childNodes.length;
			for(var i=vLen-1;i>1;i--){
				if(source.parentNode.childNodes[i].nodeType == 1){
					target = source.parentNode.childNodes[i];
					cfdump_toggleTarget( target,expand );
					cfdump_toggleSource_qry(source);
				}
			}
			if(target == null){
				//target is the last cell
				target = source.parentNode.lastChild;
				cfdump_toggleTarget( target, cfdump_toggleSource( source ) ) ;
			}
		}
	}

	cfdump_toggleSource_qry = function(source) {
		if(expand == "closed"){
			source.title = "click to expand";
			source.style.fontStyle = "italic";
		}
		else{
			source.title = "click to collapse";
			source.style.fontStyle = "normal";
		}
	}

</script> 
			<table class="cfdump_struct">
			<tr><th class="struct" colspan="2" onClick="cfdump_toggleTable(this);" style="cursor:pointer;" title="click to collapse">struct [empty]</th></tr> 
			</table>
		
 







<body class="twoColElsLtHdr">

<div id="container">

  <div id="header">
    <img src="images/USGI_Masthead.gif" />
</div>
  <div id="sidebar1">
 <table  class="displayTable">
<tr><td><a href="Profile.cfm">Home</a></td>
</tr>
<tr>
  <td><a href="VideoList.cfm">Videos Available</a></td>
</tr>

<tr>
  <td><a href="BorrowedVideo.cfm">Videos Borrowed</a></td>
</tr>
<tr>
  <td><a href="WatchedVideo.cfm">Videos Watched</a></td>
</tr>
<tr>
  <td><a href="TestRecord.cfm">Test Records</a></td>
</tr> 
<tr>
  <td><a href="VideoPopularityList.cfm">Popularity Ranking</a></td>

</tr> 
<tr>
  <td><a href="Login.cfm">Log Off</a></td>
</tr> 
<tr>
  <td>&nbsp;</td>
</tr> 
<tr>
  <td>Admin Section</td>
</tr> 
<tr>
  <td><a href="VideoCheckout.cfm">Checkout Video</a></td>

</tr>
<tr>
  <td><a href="CheckinDetail.cfm">Return Video</a></td>
<tr>
  <td><a href="AddTestDetails.cfm">Post Score</a></td>
</tr>
<tr>
  <td><a href="TestResults.cfm">Team Member<br />Profiles</a></td>
</tr>
<tr>

  <td><a href="Outstanding.cfm">Outstanding List</a></td>
</tr>
<tr>
  <td><a href="OverdueVideo.cfm">Overdue List</a></td>
</tr>
<tr>
  <td><a href="Admin.cfm">Open Account</a></td>
</tr>
<tr>
  <td><a href="Admin.cfm">Edit Account</a></td>

</tr>
<tr>
  <td><a href="Admin.cfm">Inactivate<br /> 
    Account</a></td>
</tr>
<tr>
  <td><a href="AddVideo.cfm">Add Video</a></td>
</tr>
</table>

  </div>

  <div id="mainContent">
    <table class="displayTable">
      <form name="CFForm_1" id="CFForm_1" action="AddTestDetails.cfm" method="post" onsubmit="return _CF_checkCFForm_1(this)">
      <tr>
        <th>Employee</th>
        <th>Video</th>
        <th>Number of Tests</th>

        <th>Score</th>
     </tr>
      <tr>
         <td><select name="employeeID">
            
              <option value="10">Abram                                             Uballe                                  </option>
            
              <option value="5">Alizon                                            Kiel                                    </option>
            
              <option value="1">Amy                                               Gomez                                   </option>

            
              <option value="32">Anisa                                             Shariff                                 </option>
            
              <option value="149">BarneyRubble</option>
            
              <option value="81">Bernard                                           Austin                                  </option>
            
              <option value="74">Brian                                             Hicks                                   </option>
            
              <option value="112">Bridgette                                         Hurley                                  </option>
            
              <option value="80">Catherine                                         Rademacher                              </option>

            
              <option value="111">Chris                                             Segler                                  </option>
            
              <option value="30">Christina                                         Cabanilla                               </option>
            
              <option value="54">Cindy                                             Castillo                                </option>
            
              <option value="140">Danny                                             Bennett                                 </option>
            
              <option value="28">David                                             Coolbaugh                               </option>
            
              <option value="130">Desiree                                           Tovar                                   </option>

            
              <option value="21">Eileen                                            OBrien                                  </option>
            
              <option value="150">EricKline</option>
            
              <option value="79">Evan                                              Smith                                   </option>
            
              <option value="61">Frank                                             Holmes                                  </option>
            
              <option value="119">Gina                                              Gonzales                                </option>
            
              <option value="124">Glenn                                             Grimes                                  </option>

            
              <option value="138">Herb                                              Henion                                  </option>
            
              <option value="73">Hing                                              Quan                                    </option>
            
              <option value="24">Jack                                              Dzierwa                                 </option>
            
              <option value="109">Jeff                                              Marks                                   </option>
            
              <option value="122">Jeffrey                                           Gershon                                 </option>
            
              <option value="98">Jennifer                                          Alberding                               </option>

            
              <option value="144">Jim                                               Love                                    </option>
            
              <option value="4">Joan                                              Love                                    </option>
            
              <option value="132">Joanna                                            Sawicka                                 </option>
            
              <option value="55">John                                              Derrick                                 </option>
            
              <option value="145">John                                              MacLean                                 </option>
            
              <option value="84">Josh                                              Holmes                                  </option>

            
              <option value="58">June                                              Falks                                   </option>
            
              <option value="72">Kathleen                                          Somerville                              </option>
            
              <option value="14">Kathryn                                           Narvaez                                 </option>
            
              <option value="121">Kathy                                             George                                  </option>
            
              <option value="29">Keith                                             Carlson                                 </option>
            
              <option value="96">Kelly                                             Niland                                  </option>

            
              <option value="146">Kemper                                            Dotson                                  </option>
            
              <option value="22">Kristine                                          Thomas                                  </option>
            
              <option value="23">Laurie                                            Richoux                                 </option>
            
              <option value="18">Lidia                                             Salzano                                 </option>
            
              <option value="67">Lisa                                              Aston                                   </option>
            
              <option value="12">Lisa                                              Callicotte                              </option>

            
              <option value="31">Luis                                              Gonzalez                                </option>
            
              <option value="104">Mac Dee                                           Fisher                                  </option>
            
              <option value="70">Marilyn                                           Timme                                   </option>
            
              <option value="147">Mario                                             Diaz                                    </option>
            
              <option value="120">Mark                                              Carter                                  </option>
            
              <option value="68">Martha                                            Rossington                              </option>

            
              <option value="115">Mary Ann                                          Hernandez                               </option>
            
              <option value="36">Matthew                                           Earle                                   </option>
            
              <option value="114">Max                                               Porterfield                             </option>
            
              <option value="34">Megan                                             Vichich                                 </option>
            
              <option value="91">Melissa                                           Ramos                                   </option>
            
              <option value="25">Michael                                           Ding                                    </option>

            
              <option value="148">Michael                                           Matousek                                </option>
            
              <option value="110">Michael                                           Nasto                                   </option>
            
              <option value="26">Michael                                           Shotwell                                </option>
            
              <option value="69">Mickey                                            Salinas                                 </option>
            
              <option value="41">Mike                                              Rico                                    </option>
            
              <option value="113">Nancy                                             Reed                                    </option>

            
              <option value="20">Neal                                              Lanzini                                 </option>
            
              <option value="100">Nick                                              Paveglio                                </option>
            
              <option value="78">Nigel                                             Holmes                                  </option>
            
              <option value="57">Norma                                             Fagan                                   </option>
            
              <option value="66">Patricia                                          Merced                                  </option>
            
              <option value="62">Phyllis                                           Jonas                                   </option>

            
              <option value="52">Ralph                                             Aldis                                   </option>
            
              <option value="43">Rebekah                                           Bonebreak                               </option>
            
              <option value="83">Regina                                            Gonzales                                </option>
            
              <option value="86">Rick                                              Thompson                                </option>
            
              <option value="51">Rose                                              Martinez                                </option>
            
              <option value="38">Rosie                                             Garcia                                  </option>

            
              <option value="39">Ryan                                              Cantu                                   </option>
            
              <option value="2">Ryan                                              George                                  </option>
            
              <option value="127">Sandra                                            Romero                                  </option>
            
              <option value="85">Scott                                             Jenkins                                 </option>
            
              <option value="106">Sheila                                            Matthys                                 </option>
            
              <option value="128">Susan                                             Filyk                                   </option>

            
              <option value="65">Susan                                             McGee                                   </option>
            
              <option value="137">Tana                                              Lawrence                                </option>
            
              <option value="37">Tanveer                                           Shergill                                </option>
            
              <option value="125">Terri                                             Knaus                                   </option>
            
              <option value="27">Tim                                               Steinle                                 </option>
            
              <option value="11">Tracy                                             Rios                                    </option>

            
              <option value="6">Valerie                                           Williams                                </option>
            
              <option value="76">Xian                                              Liang                                   </option>
            
            </select></td>
       
   <td width="30"> <select name="VideoID" id="VideoID">
</select>
</td>

       <td><input name="NumTests" type="text" size="5"  id="NumTests"  /></td>
       <td><input name="Test_Score" id="Test_Score"  type="text" size="5"  /></td>

      </tr>
      <tr>
        <th>Test Status</th>
        <th>Credits</th>
        <th>Test Date</th>
      </tr>
      <tr>

         <td><select id="status" select name="Test_Status" onChange="updateCredits(this, 'credits');">
            <option value='1'#UserPass#>Passed</option>
            <option value='0'#UserFail#>Fail</option>
        </select></td>
        <td><select id="credits" select name="Credits_Earned">
            <option value='0'>0</option>
            <option value='1'>1</option>

            </select></td> 
  
      </tr>
      <tr>
        <td><input type = "Submit" value = "Submit" name="Submit"></td>
      </tr>
      </form>

      <tr><td colspan="2"></td></tr>
    </table>
  </div>

</div>
</body>
</html>

</td></td></td></th></th></th></tr></tr></tr></table></table></table></a></abbrev></acronym></address></applet></au></b></banner></big></blink></blockquote></bq></caption></center></cite></code></comment></del></dfn></dir></div></div></dl></em></fig></fn></font></form></frame></frameset></h1></h2></h3></h4></h5></h6></head></i></ins></kbd></listing></map></marquee></menu></multicol></nobr></noframes></noscript></note></ol></p></param></person></plaintext></pre></q></s></samp></script></select></small></strike></strong></sub></sup></table></td></textarea></th></title></tr></tt></u></ul></var></wbr></xmp>
<style type="text/css">
.cfdebug
{
	color:black; 
	background-color:white; 
	font-family:"Times New Roman", Times, serif; 
	font-size:small
}

.cfdebuglge
{
	color:black; 
	background-color:white; 
	font-family:"Times New Roman", Times, serif; 
	font-size:medium;
}

a.cfdebuglink {color:blue; background-color:white }
</style>
<table class="cfdebug" bgcolor="white">
<tr>
	<td>

		<p class="cfdebug"><hr/>
		<b class="cfdebuglge"><a name="cfdebug_top">Debugging Information</a></b>

		<table class="cfdebug">
		<tr>
			<td class="cfdebug" nowrap>ColdFusion Server Developer</td>
			<td class="cfdebug">8,0,0,176276</td>
		</tr>
		<tr>
			<td class="cfdebug" nowrap> Template </td>

			<td class="cfdebug">/CF_Library_TestSQL/AddTestDetails.cfm</td>
		</tr>
		<tr>
			<td class="cfdebug" nowrap> Time Stamp </td>
			<td class="cfdebug">31-May-11 11:40 AM</td>
		</tr>
		<tr>

			<td class="cfdebug" nowrap> Locale </td>
			<td class="cfdebug">English (US)</td>
		</tr>
		<tr>
			<td class="cfdebug" nowrap> User Agent </td>
			<td class="cfdebug">Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1</td>

		</tr>
		<tr>
			<td class="cfdebug" nowrap> Remote IP </td>
			<td class="cfdebug">127.0.0.1</td>
		</tr>
		<tr>
			<td class="cfdebug" nowrap> Host Name </td>

			<td class="cfdebug">127.0.0.1</td>
		</tr>
		</table>
		</p>
		
			<style type="text/css">
            .template
            {	color: black; 
            	font-family: "Times New Roman", Times, serif; 
            	font-weight: normal; }
            .template_overage
            {	color: red; 
            	background-color: white; 
            	font-family: "Times New Roman", Times, serif; 
            	font-weight: bold; }
            </style>
       		<p class="cfdebug"><hr/><b class="cfdebuglge"><a name="cfdebug_execution">Execution Time</a></b></p>
            <a name="cfdebug_templates">

        
                <table border="1" cellpadding="2" cellspacing="0" class="cfdebug">
                <tr>
					<td class="cfdebug" align="center"><b>Total Time</b></td>
					<td class="cfdebug" align="center"><b>Avg Time</b></td>
					<td class="cfdebug" align="center"><b>Count</b></td>
					<td class="cfdebug"><b>Template</b></td>
				</tr>

                
    
                        <tr>
							
    	                        <td align="right" class="cfdebug" nowrap>31 ms</td>
							
                            <td align="right" class="cfdebug" nowrap>31 ms</td>
                            <td align="center" class="cfdebug" nowrap>1</td>
                            <td align="left" class="cfdebug" nowrap><img src='/CFIDE/debug/images/topdoc.gif' alt='top level' border='0'> <b>C:\Inetpub\wwwroot\CF_Library_TestSQL\AddTestDetails.cfm</b></td>
                        </tr>

                        
    
                        <tr>
							
    	                        <td align="right" class="cfdebug" nowrap>0 ms</td>
							
                            <td align="right" class="cfdebug" nowrap>0 ms</td>
                            <td align="center" class="cfdebug" nowrap>1</td>
                            <td align="left" class="cfdebug" nowrap>C:\Inetpub\wwwroot\CF_Library_TestSQL\Application.cfm</td>
                        </tr>
                        
    
                        <tr>

							
    	                        <td align="right" class="cfdebug" nowrap>0 ms</td>
							
                            <td align="right" class="cfdebug" nowrap>0 ms</td>
                            <td align="center" class="cfdebug" nowrap>1</td>
                            <td align="left" class="cfdebug" nowrap>C:\Inetpub\wwwroot\CF_Library_TestSQL\sidebar_menuAdmin.cfm</td>
                        </tr>
                        
                <tr>
					<td align="right" class="cfdebug" nowrap><i>0 ms</i></td><td colspan=2>&nbsp;</td>

                    <td align="left" class="cfdebug"><i>STARTUP, PARSING, COMPILING, LOADING, &amp; SHUTDOWN</i></td>
				</tr>
                <tr>
					<td align="right" class="cfdebug" nowrap><i>31 ms</i></td><td colspan=2>&nbsp;</td>
                    <td align="left" class="cfdebug"><i>TOTAL EXECUTION TIME</i></td>
				</tr>

                </table>
                <font color="red"><span class="template_overage">red = over 250 ms average execution time</span></font>
                </a>
            	
		<p class="cfdebug"><hr/><b class="cfdebuglge"><a name="cfdebug_sql">SQL Queries</a></b></p>
		
			<code><b>getAllEmployees</b> (Datasource=librarySQL2008, Time=0ms, Records=89) in C:\Inetpub\wwwroot\CF_Library_TestSQL\AddTestDetails.cfm @ 11:40:51.051</code><br />
			<pre>

   SELECT  EmployeeID, First_Name, Last_Name, Email
   FROM    Employees
   WHERE Role &lt; '2'
   ORDER BY First_Name, Last_Name
 </pre>
			
			
<p class="cfdebug"><hr/><b class="cfdebuglge"><a name="cfdebug_scopevars">Scope Variables</a></b></p>


<pre><b>Application Variables:</b>
applicationname=USGI_Video_Library
</pre>

<pre><b>CGI Variables:</b>

AUTH_PASSWORD=
AUTH_TYPE=
AUTH_USER=
CERT_COOKIE=
CERT_FLAGS=
CERT_ISSUER=
CERT_KEYSIZE=
CERT_SECRETKEYSIZE=
CERT_SERIALNUMBER=
CERT_SERVER_ISSUER=
CERT_SERVER_SUBJECT=
CERT_SUBJECT=
CF_TEMPLATE_PATH=C:\Inetpub\wwwroot\CF_Library_TestSQL\AddTestDetails.cfm
CONTENT_LENGTH=
CONTENT_TYPE=
CONTEXT_PATH=
GATEWAY_INTERFACE=CGI/1.1
HTTPS=off
HTTPS_KEYSIZE=
HTTPS_SECRETKEYSIZE=
HTTPS_SERVER_ISSUER=
HTTPS_SERVER_SUBJECT=
HTTP_ACCEPT=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_ENCODING=gzip, deflate
HTTP_ACCEPT_LANGUAGE=en-us,en;q=0.5
HTTP_CONNECTION=keep-alive
HTTP_COOKIE=CFID=14304; CFTOKEN=78704273; USERID=; USERHASH=; ORIGINALURLTOKEN=48186AF3%2D9650%2D45F1%2D90784B5C3A986A93; MOBILEFORMAT=false; RB=en; __utma=111872281.382149402.1304001793.1304001793.1304004590.2; __utmz=111872281.1304001793.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); JSESSIONID=f0305f914eb43aa3537950c692567571eeb1; CFAUTHORIZATION_USGI_Video_Library=am1hY2xlYW46amFrY2FsNDI6VVNHSV9WaWRlb19MaWJyYXJ5
HTTP_HOST=localhost
HTTP_REFERER=
HTTP_USER_AGENT=Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
PATH_INFO=/CF_Library_TestSQL/AddTestDetails.cfm
PATH_TRANSLATED=C:\Inetpub\wwwroot\CF_Library_TestSQL\AddTestDetails.cfm
QUERY_STRING=cfdebug
REMOTE_ADDR=127.0.0.1
REMOTE_HOST=127.0.0.1
REMOTE_USER=
REQUEST_METHOD=GET
SCRIPT_NAME=/CF_Library_TestSQL/AddTestDetails.cfm
SERVER_NAME=localhost
SERVER_PORT=80
SERVER_PORT_SECURE=0
SERVER_PROTOCOL=HTTP/1.1
SERVER_SOFTWARE=Microsoft-IIS/5.1
WEB_SERVER_API=
</pre>

<pre><b>Cookie Variables:</b>
CFAUTHORIZATION_USGI_Video_Library=am1hY2xlYW46amFrY2FsNDI6VVNHSV9WaWRlb19MaWJyYXJ5
CFID=14304
CFTOKEN=78704273
JSESSIONID=f0305f914eb43aa3537950c692567571eeb1
MOBILEFORMAT=false
ORIGINALURLTOKEN=48186AF3-9650-45F1-90784B5C3A986A93
RB=en
USERHASH=
USERID=
__utma=111872281.382149402.1304001793.1304001793.1304004590.2
__utmz=111872281.1304001793.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)
</pre>

<pre><b>Form Fields:</b>
EMPLOYEEID=
</pre>

<pre><b>Request Parameters:</b>
cfdumpinited=false
</pre>

<pre><b>Server Variables:</b>
COLDFUSION=Struct (8)
OS=Struct (5)
</pre>

<pre><b>Session Variables:</b>
employeeid=145
loggedin=Yes
role=1
sessionid=f0305f914eb43aa3537950c692567571eeb1
urltoken=CFID=14304&amp;CFTOKEN=78704273&amp;jsessionid=f0305f914eb43aa3537950c692567571eeb1
</pre>

<pre><b>URL Parameters:</b>
CFDEBUG=
</pre>

<font size="-1" class="cfdebug"><i>Debug Rendering Time: 32 ms</i></font><br />

	</td>
</tr>
</table>

Open in new window

âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
JohnMac328

ASKER
Here is your example source
<script type="text/javascript">_cf_loadingtexthtml="<div align='center'><img src='/CFIDE/scripts/ajax/resources/cf/images/loading.gif'/>";
_cf_contextpath="";
_cf_ajaxscriptsrc="/CFIDE/scripts/ajax";
_cf_jsonprefix='//';
_cf_clientid='2C0237E046853F41B3C576B25A1CF480';</script><script type="text/javascript" src="/CFIDE/scripts/ajax/yui/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/ajax/yui/dragdrop/dragdrop-min.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/ajax/yui/logger/logger-min.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/ajax/dump/dump.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/ajax/messages/cfmessage.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/ajax/package/cfajax.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/cfform.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/masks.js"></script>

<link rel="stylesheet" type="text/css" href="/CFIDE/scripts/ajax/yui/logger/assets/logger.css" />

<style>.yui-log .debug {background-color:brown}
</style>
<script type="text/javascript">
	ColdFusion.Ajax.initSelect('VideoID','VIDEOID','VIDEO_NAME');
</script>

<script type="text/javascript">
	_cf_bind_init_1306861094664=function()
	{
		ColdFusion.Bind.register([['employeeID','CFForm_1','change']],{'bindTo':'VideoID','bindToAttr':'value','cfc':'/CF_Library_TestSQL/MyComponent.cfc','cfcFunction':'getFilms','bindExpr':[['employeeID','employeeID','CFForm_1','value']]},ColdFusion.Bind.cfcBindHandler,true);
	};ColdFusion.Event.registerOnLoad(_cf_bind_init_1306861094664);
</script>
<script type="text/javascript">
<!--
    _CF_checkCFForm_1 = function(_CF_this)
    {
        //reset on submit
        _CF_error_exists = false;
        _CF_error_messages = new Array();
        _CF_error_fields = new Object();
        _CF_FirstErrorField = null;


        //display error messages and return success
        if( _CF_error_exists )
        {
            if( _CF_error_messages.length > 0 )
            {
                // show alert() message
                _CF_onErrorAlert(_CF_error_messages);
                // set focus to first form error, if the field supports js focus().
                if( _CF_this[_CF_FirstErrorField].type == "text" )
                { _CF_this[_CF_FirstErrorField].focus(); }

            }
            return false;
        }else {
            return true;
        }
    }
//-->
</script>

<!-- If index.cfm?logout=1 is clicked then Log The User Out -->
  
<body class="twoColElsLtHdr">

<div id="container">

  <div id="header">
    <img src="images/USGI_Masthead.gif" />
</div>
  <div id="sidebar1">
  </div>
  <div id="mainContent">
    <table class="displayTable">
      <form name="CFForm_1" id="CFForm_1" action="AddTestDetails.cfm" method="post" onsubmit="return _CF_checkCFForm_1(this)">
      <tr>

        <th>Employee</th>
        <th>Video</th>
        <th>Number of Tests</th>
        <th>Score</th>
     </tr>
      <tr>
        <td><select name="employeeID">

          
              <option value="1">JohnSmith</option>
          
              <option value="2">BobJones</option>
          
       </select>
   </td>
   <td width="30"> <select name="VideoID" id="VideoID">
</select>
</td>

       <td><input name="NumTests" type="text" size="5"  id="NumTests"  /></td>

       <td><input name="Test_Score" id="Test_Score"  type="text" size="5"  /></td>
      </tr>
      <tr>
        <th>Test Status</th>
        <th>Credits</th>
        <th>Test Date</th>
      </tr>

      <tr>
         <td><select id="status" select name="Test_Status" onChange="updateCredits(this, 'credits');">
            <option value='1'#UserPass#>Passed</option>
            <option value='0'#UserFail#>Fail</option>
        </select></td>
        <td><select id="credits" select name="Credits_Earned">
            <option value='0'>0</option>

            <option value='1'>1</option>
            </select></td> 

      </tr>
      <tr>
        <td><input type = "Submit" value = "Submit" name="Submit"></td>
      </tr>
      </form>

     

 </div>

</td></tr>
    </table>
  </div>
</div>
</body> 
</td></td></td></th></th></th></tr></tr></tr></table></table></table></a></abbrev></acronym></address></applet></au></b></banner></big></blink></blockquote></bq></caption></center></cite></code></comment></del></dfn></dir></div></div></dl></em></fig></fn></font></form></frame></frameset></h1></h2></h3></h4></h5></h6></head></i></ins></kbd></listing></map></marquee></menu></multicol></nobr></noframes></noscript></note></ol></p></param></person></plaintext></pre></q></s></samp></script></select></small></strike></strong></sub></sup></table></td></textarea></th></title></tr></tt></u></ul></var></wbr></xmp>
<style type="text/css">
.cfdebug
{
	color:black; 
	background-color:white; 
	font-family:"Times New Roman", Times, serif; 
	font-size:small
}

.cfdebuglge
{
	color:black; 
	background-color:white; 
	font-family:"Times New Roman", Times, serif; 
	font-size:medium;
}

a.cfdebuglink {color:blue; background-color:white }
</style>
<table class="cfdebug" bgcolor="white">
<tr>
	<td>

		<p class="cfdebug"><hr/>

		<b class="cfdebuglge"><a name="cfdebug_top">Debugging Information</a></b>
		<table class="cfdebug">
		<tr>
			<td class="cfdebug" nowrap>ColdFusion Server Developer</td>
			<td class="cfdebug">8,0,0,176276</td>
		</tr>
		<tr>

			<td class="cfdebug" nowrap> Template </td>
			<td class="cfdebug">/CF_Library_TestSQL/agxtest.cfm</td>
		</tr>
		<tr>
			<td class="cfdebug" nowrap> Time Stamp </td>
			<td class="cfdebug">31-May-11 11:58 AM</td>

		</tr>
		<tr>
			<td class="cfdebug" nowrap> Locale </td>
			<td class="cfdebug">English (US)</td>
		</tr>
		<tr>
			<td class="cfdebug" nowrap> User Agent </td>

			<td class="cfdebug">Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1</td>
		</tr>
		<tr>
			<td class="cfdebug" nowrap> Remote IP </td>
			<td class="cfdebug">127.0.0.1</td>
		</tr>
		<tr>

			<td class="cfdebug" nowrap> Host Name </td>
			<td class="cfdebug">127.0.0.1</td>
		</tr>
		</table>
		</p>
		
			<style type="text/css">
            .template
            {	color: black; 
            	font-family: "Times New Roman", Times, serif; 
            	font-weight: normal; }
            .template_overage
            {	color: red; 
            	background-color: white; 
            	font-family: "Times New Roman", Times, serif; 
            	font-weight: bold; }
            </style>
       		<p class="cfdebug"><hr/><b class="cfdebuglge"><a name="cfdebug_execution">Execution Time</a></b></p>

            <a name="cfdebug_templates">
        
                <table border="1" cellpadding="2" cellspacing="0" class="cfdebug">
                <tr>
					<td class="cfdebug" align="center"><b>Total Time</b></td>
					<td class="cfdebug" align="center"><b>Avg Time</b></td>
					<td class="cfdebug" align="center"><b>Count</b></td>
					<td class="cfdebug"><b>Template</b></td>

				</tr>
                
    
                        <tr>
							
    	                        <td align="right" class="cfdebug" nowrap>0 ms</td>
							
                            <td align="right" class="cfdebug" nowrap>0 ms</td>
                            <td align="center" class="cfdebug" nowrap>1</td>
                            <td align="left" class="cfdebug" nowrap><img src='/CFIDE/debug/images/topdoc.gif' alt='top level' border='0'> <b>C:\Inetpub\wwwroot\CF_Library_TestSQL\AGXTEST.cfm</b></td>

                        </tr>
                        
    
                        <tr>
							
    	                        <td align="right" class="cfdebug" nowrap>0 ms</td>
							
                            <td align="right" class="cfdebug" nowrap>0 ms</td>
                            <td align="center" class="cfdebug" nowrap>1</td>
                            <td align="left" class="cfdebug" nowrap>C:\Inetpub\wwwroot\CF_Library_TestSQL\Application.cfm</td>
                        </tr>

                        
                <tr>
					<td align="right" class="cfdebug" nowrap><i>16 ms</i></td><td colspan=2>&nbsp;</td>
                    <td align="left" class="cfdebug"><i>STARTUP, PARSING, COMPILING, LOADING, &amp; SHUTDOWN</i></td>
				</tr>
                <tr>
					<td align="right" class="cfdebug" nowrap><i>16 ms</i></td><td colspan=2>&nbsp;</td>

                    <td align="left" class="cfdebug"><i>TOTAL EXECUTION TIME</i></td>
				</tr>
                </table>
                <font color="red"><span class="template_overage">red = over 250 ms average execution time</span></font>
                </a>
            	
		<p class="cfdebug"><hr/><b class="cfdebuglge"><a name="cfdebug_sql">SQL Queries</a></b></p>
		
			<code><b>getAllEmployees</b> (Datasource=librarySQL2008, Time=0ms, Records=2) in C:\Inetpub\wwwroot\CF_Library_TestSQL\AGXTEST.cfm @ 11:58:14.014</code><br />

			<pre>
	SELECT 1 AS EmployeeID, 'John' AS First_name, 'Smith' AS Last_Name, 'j1@com.com' AS Email UNION
	SELECT 2 AS EmployeeID, 'Bob' AS First_name, 'Jones' AS Last_Name, 'j2@com.com' AS Email 
</pre>
			
			
<p class="cfdebug"><hr/><b class="cfdebuglge"><a name="cfdebug_scopevars">Scope Variables</a></b></p>


<pre><b>Application Variables:</b>
applicationname=USGI_Video_Library
</pre>

<pre><b>CGI Variables:</b>

AUTH_PASSWORD=
AUTH_TYPE=
AUTH_USER=
CERT_COOKIE=
CERT_FLAGS=
CERT_ISSUER=
CERT_KEYSIZE=
CERT_SECRETKEYSIZE=
CERT_SERIALNUMBER=
CERT_SERVER_ISSUER=
CERT_SERVER_SUBJECT=
CERT_SUBJECT=
CF_TEMPLATE_PATH=C:\Inetpub\wwwroot\CF_Library_TestSQL\AGXTEST.cfm
CONTENT_LENGTH=
CONTENT_TYPE=
CONTEXT_PATH=
GATEWAY_INTERFACE=CGI/1.1
HTTPS=off
HTTPS_KEYSIZE=
HTTPS_SECRETKEYSIZE=
HTTPS_SERVER_ISSUER=
HTTPS_SERVER_SUBJECT=
HTTP_ACCEPT=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_ENCODING=gzip, deflate
HTTP_ACCEPT_LANGUAGE=en-us,en;q=0.5
HTTP_CONNECTION=keep-alive
HTTP_COOKIE=CFID=14304; CFTOKEN=78704273; USERID=; USERHASH=; ORIGINALURLTOKEN=48186AF3%2D9650%2D45F1%2D90784B5C3A986A93; MOBILEFORMAT=false; RB=en; __utma=111872281.382149402.1304001793.1304001793.1304004590.2; __utmz=111872281.1304001793.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); JSESSIONID=f0305f914eb43aa3537950c692567571eeb1; CFAUTHORIZATION_USGI_Video_Library=am1hY2xlYW46amFrY2FsNDI6VVNHSV9WaWRlb19MaWJyYXJ5
HTTP_HOST=localhost
HTTP_REFERER=
HTTP_USER_AGENT=Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
PATH_INFO=/CF_Library_TestSQL/agxtest.cfm
PATH_TRANSLATED=C:\Inetpub\wwwroot\CF_Library_TestSQL\AGXTEST.cfm
QUERY_STRING=cfdebug
REMOTE_ADDR=127.0.0.1
REMOTE_HOST=127.0.0.1
REMOTE_USER=
REQUEST_METHOD=GET
SCRIPT_NAME=/CF_Library_TestSQL/agxtest.cfm
SERVER_NAME=localhost
SERVER_PORT=80
SERVER_PORT_SECURE=0
SERVER_PROTOCOL=HTTP/1.1
SERVER_SOFTWARE=Microsoft-IIS/5.1
WEB_SERVER_API=
</pre>

<pre><b>Cookie Variables:</b>
CFAUTHORIZATION_USGI_Video_Library=am1hY2xlYW46amFrY2FsNDI6VVNHSV9WaWRlb19MaWJyYXJ5
CFID=14304
CFTOKEN=78704273
JSESSIONID=f0305f914eb43aa3537950c692567571eeb1
MOBILEFORMAT=false
ORIGINALURLTOKEN=48186AF3-9650-45F1-90784B5C3A986A93
RB=en
USERHASH=
USERID=
__utma=111872281.382149402.1304001793.1304001793.1304004590.2
__utmz=111872281.1304001793.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)
</pre>

<pre><b>Server Variables:</b>
COLDFUSION=Struct (8)
OS=Struct (5)
</pre>

<pre><b>Session Variables:</b>
employeeid=145
loggedin=Yes
role=1
sessionid=f0305f914eb43aa3537950c692567571eeb1
urltoken=CFID=14304&amp;CFTOKEN=78704273&amp;jsessionid=f0305f914eb43aa3537950c692567571eeb1

</pre>

<pre><b>URL Parameters:</b>
CFDEBUG=
</pre>

<font size="-1" class="cfdebug"><i>Debug Rendering Time: 16 ms</i></font><br />

	</td>
</tr>
</table>

Open in new window

_agx_

Which one throws the javascript error? The sample, your original code, or both?
JohnMac328

ASKER
Both
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
_agx_

I think it's definitely something in your environment... I can run both against the dummy cfc and they work fine. Just changed the path.

ColdFusion.Bind.register([['employeeID','CFForm_1','change']],
            {'bindTo':'VideoID','bindToAttr':'value','cfc':'/test/Mycomponent.cfc',

So .. do *any* binds work on your server? If not, maybe that's your problem. Have you checked your IIS virtual mappings?


_agx_

Let me try FF again to be sure it works there too.
JohnMac328

ASKER
Yes - this code shows employees that are eligible to check out videos
SELECT  Employees.EmployeeID, Employees.Last_name, Employees.First_name, Email
FROM    Employees LEFT JOIN 
      (     SELECT EmployeeID, COUNT(*) AS TotalNotCheckedIn
            FROM   Detail
            WHERE  out_date IS NOT NULL 
            AND    In_Date IS NULL
            GROUP BY EmployeeID
            HAVING COUNT(*) > 1
        ) 
        mx ON Employees.EmployeeID = mx.EmployeeID
WHERE   mx.EmployeeID IS NULL and Role <> '2'
ORDER BY First_Name, Last_Name

Open in new window

âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
_agx_

Nope, it didn't work in FF.

Try this version. It's more well formed. Don't change anything except the dsn.

<cfset datasource  = "YourDatasource">

<html>
<head>
<cfquery name="getAllEmployees"   datasource="#datasource#">
	SELECT 1 AS EmployeeID, 'John' AS First_name, 'Smith' AS Last_Name, 'j1@com.com' AS Email UNION
	SELECT 2 AS EmployeeID, 'Bob' AS First_name, 'Jones' AS Last_Name, 'j2@com.com' AS Email 
</cfquery>

</head>
<body>
	<cfform action="AddTestDetails.cfm" method="post" format="html">
    <table class="displayTable">
      <tr>
        <th>Employee</th>
        <th>Video</th>
        <th>Number of Tests</th>
        <th>Score</th>
     </tr>
      <tr>
        <td><cfselect name="employeeID">
          <cfoutput query="getAllEmployees">
              <option value="#employeeID#">#First_Name##Last_Name#</option>
          </cfoutput>
       </cfselect>
   </td>
   <td width="30"> <cfselect name="VideoID" 
                        bind="cfc:MyComponent.getFilms({employeeID})"
                        value="VideoID" display="Video_Name"
      	                bindOnLoad="true"/>
</td>

       <td><cfinput type="text" id="NumTests" name="NumTests" size="5"></td>
       <td><cfinput type="text" name="Test_Score" size="5"></td>
      </tr>
      <tr>
        <th>Test Status</th>
        <th>Credits</th>
        <th>Test Date</th>
      </tr>
      <tr>
         <td><select id="status" select name="Test_Status" onChange="updateCredits(this, 'credits');">
            <option value='1'#UserPass#>Passed</option>
            <option value='0'#UserFail#>Fail</option>
        </select></td>
        <td><select id="credits" select name="Credits_Earned">
            <option value='0'>0</option>
            <option value='1'>1</option>
            </select></td> 
            <td><cfinput type="datefield" name="Test_Date"></td>
      </tr>
      <tr>
        <td><input type = "Submit" value = "Submit" name="Submit"></td>
      </tr>
	</table>
      </cfform>
</body>
</html>

Open in new window




JohnMac328

ASKER
No error but no video list either
ColdFusion AJAX Logger

info:http: CFC invocation response: {"COLUMNS":["EMPLOYEEID","VIDEOID","VIDEO_NAME","NUMTESTS"],"DATA":[[0,0,"Selected EmployeeID 1",0],[1,3,"Video 32",0],[2,3,"Video 31",0]]}

info:http: HTTP GET /CF_Library_TestSQL/MyComponent.cfc?method=getFilms&returnFormat=json&argumentCollection=%7B%22employeeID%22%3A%221%22%7D&_cf_nodebug=true&_cf_nocache=true&_cf_clientid=2C0237E046853F41B3C576B25A1CF480&_cf_rc=0

info:http: Invoking CFC: /CF_Library_TestSQL/MyComponent.cfc , function: getFilms , arguments: {"employeeID":"1"}

info:LogReader: LogReader initialized

info:global: Logger initialized

Open in new window

_agx_

Yeah, but remember those are just dummy employeeID's. Try it again with real employee id's now. Just replace this with your real cfquery:

<cfquery name="getAllEmployees"   datasource="#datasource#">
      SELECT 1 AS EmployeeID, 'John' AS First_name, 'Smith' AS Last_Name, 'j1@com.com' AS Email UNION
      SELECT 2 AS EmployeeID, 'Bob' AS First_name, 'Jones' AS Last_Name, 'j2@com.com' AS Email
</cfquery>


I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
_agx_

No error but no video list either

Oh wait... are you using the sample CFC or your real CFC?

JohnMac328

ASKER
The one you sent with this query in it

SELECT 0 AS EmployeeID, 0 AS VideoID, 'Selected EmployeeID #arguments.employeeID#' AS Video_Name, 0 AS NumTests UNION
                  SELECT 1 AS EmployeeID, 3 AS VideoID, 'Video 32' AS Video_Name, 0 AS NumTests UNION
                  SELECT 2 AS EmployeeID, 3 AS VideoID, 'Video 31' AS Video_Name, 0 AS NumTests
JohnMac328

ASKER
Same as my page - it shows the correct videos in the AJAX window but not on the page
âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
_agx_

Ok. But if I run that code in FF my ajax log looks just like yours. There's no error and the video list *is* populated.

info:http: CFC invocation response: {"COLUMNS":["EMPLOYEEID","VIDEOID","VIDEO_NAME","NUMTESTS"],"DATA":[[0,0,"Selected EmployeeID 1",0],[1,3,"Video 32",0],[2,3,"Video 31",0]]}

info:http: HTTP GET /test/MyComponent.cfc?method=getFilms&_cf_ajaxproxytoken=xxxblahxxx&returnFormat=json&argumentCollection=%7B%22employeeID%22%3A%221%22%7D&_cf_nodebug=true&_cf_nocache=true&_cf_clientid=xxxxxxblahxxxxx&_cf_rc=0

info:http: Invoking CFC: /test/MyComponent.cfc , function: getFilms , arguments: {"employeeID":"1"}

info:LogReader: LogReader initialized

info:global: Logger initialized

Open in new window




_agx_

it shows the correct videos in the AJAX window but not on the page

If the list isn't populating, there has to be an error somewhere.  In the ajax log or FF console.
JohnMac328

ASKER
No matter what code I use I can't get the list to populate or an error to display.  Oh well - it is not a show stopper.  The program still works, just bugs me that it should
Your help has saved me hundreds of hours of internet surfing.
fblack61
_agx_

Frankly it bugs me too because such a simple bind should work! It's .. bizarre that it doesn't. Since we're using the same code same version CF9, the only differences should be environmental like :

- Maybe your Application.cfc is interfering w/ajax ?
- Possible IIS virtual mapping problem ?

Though if that were the problem, I'd think you'd have a problem with ajax features like binds. That's why I was asking if *any* binds work on your site.  Aside from adding <cfsetting showdebugoutput="false">, I can't think of anything else to try since I can't see the site. Very weird...
JohnMac328

ASKER
I appreciate all the help though - we can resolve this anyway you want.
_agx_

<script type="text/javascript">
var arrFilms = [<cfoutput query="getAllFilms">{'videoid':#videoid#, 'NumTests':#NumTests#} ...


Like I said earlier, you could make it work old-style like you were doing with "NumTests". But .. that's not scalable, which is why I suggested binds in the 1st place.

However you want to handle it's fine with me. Honestly the question *wasn't* answered. I just wish we'd been able to figure out the issue.  Yes I'm stubborn .. but I *hate* unsolved code mysteries ;)
âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
JohnMac328

ASKER
LOL - Me too
_agx_

Haha - no wonder we get along ;-)
JohnMac328

ASKER
So true
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
JohnMac328

ASKER
Hey agx -

This worked for some reason - what a weird trip


<cfselect name="employeeID" query="getAllEmployees" display="FullName" value="employeeID" selected="#form.employeeID#" onchange="this.form.submit();"></cfselect>

Open in new window

_agx_

>> <cfselect ...onchange="this.form.submit();"></cfselect>

this.form.submit() definitely works, but it works by submitting the page back to the server each time. ie the old way of doing things before ajax. The bind is supposed to replace that by getting new data _without_ submitting the form back to the server.
JohnMac328

ASKER
I see - well at least in this case it is only being used by 100 employees and not very often.
âš¡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
_agx_

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
JohnMac328

ASKER
I hear ya - something was up.  I still don't know how to resolve this one and I would rather it not be in the knowledge base - way too long
_agx_

Yeah, it is epic length ;) I'm totally okay with deleting it.
_agx_

> deleting it.

... not because of the length obviously ;) Because it wasn't really *answered* IMO.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
JohnMac328

ASKER
Sounds good - But I will be back :)