CFselect Code

Hi Experts,
Can you look ta my code I have a CFSelect Bind and for some reason my data is not coming back to my page.  
<!---CFC Page--->
<cfcomponent >
<cffunction name="get_attribute" access="remote" returnType="query">
 <CFQUERY NAME="attribute" DATASOURCE="#application.dsn#">
 SELECT distinct T.EID,
        T.TYPE_CODE,
        T.ATTRIBUTE_LABEL_CODE,
        T.ATTRIBUTE_LABEL_DESCRIPTION
   FROM CSR.CUSTOM_ATTRIBUTES_TEMPLATES T, CSR.ST_CODES C
  WHERE T.ATTRIBUTE_LABEL_CODE IN ('WHATIST2','WHATIST3')
    AND T.ALLOWABLE_GROUP_CODES = 'RIGHTOFW'
    AND T.LOV_TYPE_CODE = C.TYPE_CODE
    AND T.STOP_DATE IS NULL
    AND C.STOP_DATE IS NULL
</CFQUERY>
		<cfreturn attribute>
	</cffunction>
    
	<cffunction name="get_desc" access="remote" returntype="query">
		<cfargument name="ATTRIBUTE_LABEL_CODE">
        <cfquery name="desc" DATASOURCE="#application.dsn#">>
                   SELECT T.EID,
                C.DESCRIPTION,
                T.TYPE_CODE,
                T.ATTRIBUTE_LABEL_CODE,
                T.LOV_TYPE_CODE,
                C.CODE_CODE
           FROM CSR.CUSTOM_ATTRIBUTES_TEMPLATES T, CSR.ST_CODES C
          WHERE T.ALLOWABLE_GROUP_CODES = 'RIGHTOFW'
            AND T.LOV_TYPE_CODE = C.TYPE_CODE
            AND T.STOP_DATE IS NULL
            AND C.STOP_DATE IS NULL
            and T.ATTRIBUTE_LABEL_CODE = #arguments.ATTRIBUTE_LABEL_CODE#
          ORDER BY C.DESCRIPTION ASC
     	</cfquery>
		<cfreturn desc>
	</cffunction>
</cfcomponent> 


<!---form--->
 
  <cfoutput>
    <cfform name="dept_desc" >
      <table  width="" border="0">
        <tr>
          <td >Select Question</td>
          <td><div align="left">
              <!--- First Ajax Control - Auto Bound --->
              <cfselect name="select_attribute"
              bind="cfc:exam1.get_attribute()" 
              display="ATTRIBUTE_LABEL_DESCRIPTION" 
              value="ATTRIBUTE_LABEL_CODE"
              bindonload="true" 
              required="yes" 
              message="Please Select Question"></cfselect> 
          <td>Select Outcome</span></td>
          <td><div align="left">
              <!--- Second Ajax Control - Bound on Selection of Select_Manufacturer--->
              <cfselect 
              name="Select " 
              bind="cfc:exam1.GetSubModules({select_Manufacturer})"
              display="DESCRIPTION" 
              value="ATTRIBUTE_LABEL_CODE " 
              required="yes" 
              message="Please Select Outcome">
              </cfselect> 
            </div></td>
      </table>
      </td>
      </tr>
      </table>
    </cfform>
  </cfoutput>

Open in new window

JeniceMAsked:
Who is Participating?
 
erikTsomikConnect With a Mentor System Architect, CF programmer Commented:
I think you are using the wrong form name it should this
<cfoutput>
    <cfform name="dept_desc" >
      <table  width="" border="0">
        <tr>
          <td >Select Question</td>
          <td><div align="left">
              <!--- First Ajax Control - Auto Bound --->
              <cfselect name="select_attribute"
              bind="cfc:exam1.get_attribute()"
              display="ATTRIBUTE_LABEL_DESCRIPTION"
              value="ATTRIBUTE_LABEL_CODE"
              bindonload="true"
              required="yes"
              message="Please Select Question"></cfselect>
          <td>Select Outcome</span></td>
          <td><div align="left">
              <!--- Second Ajax Control - Bound on Selection of Select_Manufacturer--->
              <cfselect
              name="Select " 
              bind="cfc:exam1.GetSubModules({select_attribute})"
              display="DESCRIPTION"
              value="ATTRIBUTE_LABEL_CODE " 
              required="yes"
              message="Please Select Outcome">
              </cfselect>
            </div></td>
      </table>
0
 
JeniceMAuthor Commented:
I changed it and the data is still not coming back to my form.

    <cfform name="dept_desc" >
      <table  width="" border="0">
        <tr>
          <td >Select Question</td>
          <td><div align="left">
              <!--- First Ajax Control - Auto Bound --->
              <cfselect name="select_attribute"
              bind="cfc:exam1.get_attribute()"
              display="ATTRIBUTE_LABEL_DESCRIPTION"
              value="ATTRIBUTE_LABEL_CODE"
              bindonload="true"
              required="yes"
              message="Please Select Question"></cfselect>
          <td>Select Outcome</span></td>
          <td><div align="left">
              <!--- Second Ajax Control - Bound on Selection of Select_Manufacturer--->
              <cfselect
              name="Select " 
              bind="cfc:exam1.get_desc({select_attribute})"
              display="DESCRIPTION"
              value="ATTRIBUTE_LABEL_CODE " 
              required="yes"
              message="Please Select Outcome">
              </cfselect>
            </div></td>
      </table>
    </cfform>
  </cfoutput>

0
 
erikTsomikConnect With a Mentor System Architect, CF programmer Commented:
where do you declare the ajax call

<cfajaxproxy

and take a look at this
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_a-b_3.html
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
JeniceMAuthor Commented:
at the begining of the form. Is this correct? <cfajaxproxy cfc="exam1" jsclassname="exam1">  The .cfc is called "exam1", This is my first time using this.
0
 
JeniceMAuthor Commented:
I added it and the data still do not come back to the form.
0
 
_agx_Connect With a Mentor Commented:
First, do your CFC methods work on their own (ie without the ajax part)?  Second, assuming you're not on a shared server, enable the ajax debugging console to get more information.  
http://livedocs.adobe.com/coldfusion/8/htmldocs/ajaxdata_10.html
0
 
_agx_Connect With a Mentor Commented:
> where do you declare the ajax call
> <cfajaxproxy


    No. You don't need cfajaxproxy for the code you posted.
0
 
_agx_Connect With a Mentor Commented:
> First, do your CFC methods work on their own

   In other words, test it in steps. (I suspect the problem is in step#1 or #2)

  1. Check the query used by the first cfselect. Does it return data or does an error occur?

        <cfinvoke component="Exam1" method="get_attribute"
            returnvariable="qResults1" />
         <cfdump var="#qResults1#">            

  2. Check the query used by the second cfselect. Does it return data or does an error occur?
         <cfinvoke component="Exam1" method="get_desc"
             ATTRIBUTE_LABEL_CODE="(put in valid value here)"       
             returnvariable="qResults2" />
        <cfdump var="#qResults2#">

   3. If steps #1 and #2 work, then enable the ajax debugging console to get more information
       http://livedocs.adobe.com/coldfusion/8/htmldocs/ajaxdata_10.html
0
 
JeniceMAuthor Commented:
Thanks for your help but I did something else, I could never get this to work.
0
 
_agx_Commented:
> Thanks for your help but I did something else, I could never get this to work.

I'm glad you found something that worked.  But just for future reference

1) It's good to try all of the experts suggestions first, and report back on the results.  Based on the image you posted on the duplicate thread, and my tests of your code,  it was likely a simple problem with your CFC that could have been fixed.  Enabling ajax logging probably would have indicated what the issue was ...

2) Try to avoid duplicate questions. I believe there's a 500 pt max on questions at EE

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.