Binding a cfc to cfgrid

Basically, I can't get the cfgrid to function properly. I get
the following error.
You cannot specify more arguments to a CFC function than it
declares.
Here's the cfc:
<cfcomponent>
<cffunction name="getArtwork" access="remote"
returntype="query">
<cfset artwork="">
<cfquery name="artwork" datasource="cfgettingstarted">
SELECT FIRSTNAME, LASTNAME, ARTNAME, DESCRIPTION, PRICE,
LARGEIMAGE, ISSOLD, MEDIATYPE
FROM ARTISTS, ART, MEDIA
WHERE ARTISTS.ARTISTID = ART.ARTISTID
AND ART.MEDIAID = MEDIA.MEDIAID
</cfquery>
<cfreturn artwork>
</cffunction>
</cfcomponent>
Here's the cfgrid:
<cfform name="main" width="600">
<cfgrid name="data" format="Html" pagesize="5" width="900"
stripeRows = "yes" stripeRowColor = "##e0e0e0"
bind="cfc:art.getArtwork({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdire ction})">
<cfgridcolumn name="ARTNAME" header="Art Name">
<cfgridcolumn name="DESCRIPTION" header="Description">
<cfgridcolumn name="PRICE" header="Price">
</cfgrid>
</cfform>

Here's the cfc with the attributes defined:
<cfcomponent>
<cffunction name="getArtwork" access="remote"
returntype="query">
<cfargument name="page" required="yes">
<cfargument name="pageSize" required="yes">
<cfargument name="gridsortcolumn" required="yes">
<cfargument name="gridsortdirection" required="yes">
<cfset artwork="">
<cfquery name="artwork" datasource="cfgettingstarted">
SELECT FIRSTNAME, LASTNAME, ARTNAME, DESCRIPTION, PRICE,
LARGEIMAGE, ISSOLD, MEDIATYPE
FROM ARTISTS, ART, MEDIA
WHERE ARTISTS.ARTISTID = ART.ARTISTID
AND ART.MEDIAID = MEDIA.MEDIAID
</cfquery>
<cfreturn artwork>
</cffunction>
</cfcomponent>
Here's the cfgrid:
<cfform name="main" width="600">
<cfgrid name="data" format="Html" pagesize="5" width="900"
stripeRows = "yes" stripeRowColor = "##e0e0e0"
bind="cfc:art.getArtwork({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdire ction})">
<cfgridcolumn name="ARTNAME" header="Art Name">
<cfgridcolumn name="DESCRIPTION" header="Description">
<cfgridcolumn name="PRICE" header="Price">
</cfgrid>
</cfform>

Similar Messages

  • CFGRID with bind to CFC for an incorrect JAVAScript

    Hi,
    I am using CF11 with SQL server 2012 & IIS8.0 on windows server 2012.
    When I am using a CFGRID bind to a CFC and passing 2 or more than 2 parameters from a FORM, it fails for an incorrect JavaScript.
    Using the below code:
    <cfgrid attributeCollection="#args#"
    bind="cfc:MaintenanceMenuComponent.getLookUpData({cfgridpage},{cfgridpagesize},{cfgridsortcolum n},{cfgridsortdirection},{appl},{search})"
           onchange="cfc:MaintenanceMenuComponent.editLookUpData({cfgridaction},{cfgridrow},{cfgridchanged})"
           onerror="errorHandler" bindOnLoad="true">
    Getting Result:
    JavaScript Error for:
    SyntaxError: missing ; before statement
    ...id'] = 'applid,appl,,value;'search,search,,value';var _cf_gridDataModel = Ext.cr...
    I have checked the Adobe blog and found that this type of bug (Bug ID# 3759630) is already reported and fixed in ColdFusion 11 Update 1 (Suggested by Anit Kumar Panda Ref: https://bugbase.adobe.com/index.cfm?event=bug&id=3759630).
    I have sent update request to '[email protected]' but did not receive any update from them yet.
    As this update is still not available on Adobe site, can anyone send me that link of the update or let me know if there any workarounds.
    Thanks in advance

    MAHI,
    The issue exists and is fixed. The fix would be made available in a future udpate. The error you are reporting seems different, though.
    The bind attribute appears to have a typo. Shouldn't "{cfgridsortcolum n}" just be "{cfgridsortcolum}", or is that intended?
    The email address that you wrote to for the fix seems correct. Can you pls. resend the request.

  • cfselect with bind to cfc works but is followed by 500 Jrun javax.servlet.ServletException

    All;
    This is driving me crazy. 
    I have a CFC with a function that returns countries via remote as JSON with the // prefix as Cold Fusion is configured.
    I call it with the following url
    www.mydomain.com/getCountriesAndStates.cfc?method=getCountries&returnFormat=json&argumentC ollection={}&_cf_nodebug=true&_cf_nocache=true
    It returns countries according to the Cold Fusion specs (just imagine it returning all countries, didn't want to paste it all the countries here).
    //[[0.0,"Please select a country..."],["US","UNITED STATES"],["CA","CANADA"]] 
    I bind a <cfselect for countrycode to this CFC and it works about 30% of the time.
    Here is the <cfselect
    <cfselect name="CountryCode" id="spanCountryCode" bind="cfc:getCountriesAndStates.getCountries()" bindonload="true"  onChange="DEdetermineTohide(this.id, '1')" onKeyUp="DEdetermineTohide(this.id, '1')">   
            </cfselect>
    It has a second function that returns the States with a CountryCode as the argument. 
    I call it with the follow url
    /getCountriesAndStates.cfc?method=getStateProvince&returnFormat=json&argumentCollection={" countrycode":"US"}&_cf_nodebug=true&_cf_nocache=true
    It returns states according to the old Fusion specs (just imagine it returning all the states, didn't want to paste all the states here.)
    //[[0.0,"Please select a state..."],["AL","ALABAMA"],["AK","ALASKA"]]
    I bind a <cfselect to this CFC with the countrycode as an argument and it populates the states for the countrycoe about 30% of the time.  It fails when the getCountries call fails.
    Here is the State <cfselect
    <cfselect name="StateCode" bind="cfc:getCountriesAndStates.getStateProvince({CountryCode})">
            </cfselect>
    I have a third funtion that returns whether or not the country selected has States and Zip Codes.  I call this function from a seperate javascript script included in the header and fired from the <cfselect name="CountryCode for onChange or onKeyUp.  It basically determines whether or not to show or hide both the State or Zip span but calls the CFC so that I can encapsulate everything in one place.  So the state and zip span with <cfselect and <cfinput appear and disappear based on the information about the country and state and the labels can change too from State to Province and from Zip to Postal Code etc...
    /getCountriesAndStates.cfc?method=getStateZipMetaData&returnFormat=json&argumentCollection ={"countrycode":"US"}&_cf_nodebug=true&_cf_nocache=true
    Ok, so I hope I have described enough about what I am doing.  This works about 30% of the time and fails about 70% of the time.  Flawlessly.  Sometimes it works for hours.  But eventually for some reason AFTER a perfectly good JSON response is returned from Cold Fusion, the Cold Fusion server starts following the JSON response with a 500 Serverlet Exception error.  This happesn on all function calls until I reboot my machine.
    It is driving me mad and making me start to reconsider whether or not I want to use CFForm binding.  It seems like a nice elegant solution that really simplifies and reduces the amount of javascript I have to write, but I can't go to production with forms that produce 500 server errors.
    Anyone have any ideas on what is going on?  If this is a bug?
    Should I just stay away from <cfform binding?
    Please help because it is driving me really crazy.
    My platform information is below.
    About 70% of the time it returns all the countries followed by a 500 Servlet Exception error.
    500
    javax.servlet.ServletException
         at coldfusion.xml.rpc.CFCServlet.invoke(CFCServlet.java:154)
         at coldfusion.xml.rpc.CFCServlet.doGet(CFCServlet.java:264)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
         at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
         at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
         at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
         at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
         at jrun.servlet.FilterChain.service(FilterChain.java:101)
         at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
         at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
         at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
         at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
         at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
         at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
         at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
         at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
         at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
    Platform details
    Server Product
    ColdFusion
    Version
    9,0,0,251028 
    Edition
    Developer 
    Operating System
    Windows XP 
    OS Version
    5.1 
    Adobe Driver Version
    4.0 (Build 0005) 
    JVM Details
    Java Version
    1.6.0_14 
    Java Vendor
    Sun Microsystems Inc. 
    Java Vendor URL
    http://java.sun.com/ 
    Java Home
    C:\ColdFusion9\runtime\jre 
    CF9 Update 1
    Apache 2.2
    Database MS-SQL Express

    Ok, so I think I answered this for myself.  This may be ignorant.  Whatever.  I haven't programmed CF in over 10 years and just started again a month ago, so I think advanced CFC and javascript is a lot.
    I seperated my CFC into a directory with a Alias mapping under Apache and a CF Mapping from CFIDE
    I trimmed down the application.cfc
    It was
    <cfset This.clientstorage="Cookie">
    That was causing the remoting CFC's to return a 500 Jrun Servlet Error
    I am just going to keep my remote CFC's seperate from the rest of my application anyway because they need a different type of security schema.
    So, if anyone struggles with this.  I recommend just put your remotely accessd CFC's in a seperate virtual directory mapped from your webserver and CF and lock them down both with a trimmed down application.cfc and some kind of security.
    They also seem to run much faster now combined with my other Ajax and Javascript.

  • Autosuggest with bind to cfc only displaying every 2nd character

    This seems a bit strange. As I enter text (even slowly) the autosuggest only seems to display after every 2nd character entered.
    You can view the problem at http://karaoke.com.au in the search fields. It occurs in all 3 search entry fields (Disc, Title and Artist) In addition, as you remove characters, the autosuggset doesn't always update either?
    Any autosuggestions anyone?

    Hey Adam,
    Thanks for taking the time to take a look. I'm a bit surprised that you are getting the correct result there? I tested in IE8 and FF3 as well.
    As you type in a title, say, "To all the girls I've loved before" as you type the "T" I'm expecting the autosuggest to start suggesting my top 20 of titles beginning with "T" but, what I see is the little ajax loading spinner and then nothing until after I type in the next 2 characters when all of a sudden, I get the autosuggest. Having got the autosuggest displayed once, when I start deleting characters, I tend to get the expected behaviour as I go back one character at a time. Please note that no matter how slow I go, I still get these symptoms???
    Anyway here's my code for the form:
    <div class="search_element">
        <label for="disc">Disc</label><br />
        <cfinput style="width:60px;height:16px;" name="disc" value="#request.search.songs.disc#" autosuggest="cfc:karaoke.com.auto_suggest.find_disc({cfautosuggestvalue})" autosuggestminlength="1" maxresultsdisplayed="20">
      </div>
      <div class="search_element">
        <label for="disc">Title</label><br />
        <cfinput style="width:130px;height:16px;" name="title" value="#request.search.songs.title#" autosuggest="cfc:karaoke.com.auto_suggest.find_title({cfautosuggestvalue})" autosuggestminlength="1" maxresultsdisplayed="20"></cfinput>
      </div>
      <div class="search_element">
        <label for="disc">Artist</label><br />
        <cfinput style="width:130px;height:16px;" name="artist" value="#request.search.songs.artist#" autosuggest="cfc:karaoke.com.auto_suggest.find_artist({cfautosuggestvalue})" autosuggestminlength="1" maxresultsdisplayed="20"></cfinput>
      </div>
    And here's the CFC:
    <cfcomponent output="true">
            <cffunction name="find_disc" access="remote" returntype="string">
              <cfargument name="search" type="any" required="false" default="">
              <!--- Query discs --->
              <cfquery name="results" datasource="#dsn#" maxrows="20" >
                 select   distinct     discs.disc
                  from        discs
                  where        disc like '#arguments.search#%'
                  order by    disc
              </cfquery>
             <!--- And return it as a List --->
              <cfreturn  valueList(results.disc) >
          </cffunction>
            <cffunction name="find_title" access="remote" returntype="string">
                <cfargument name="search" type="any" required="false" default="">
              <!--- Query discs --->
              <cfquery name="results" datasource="#dsn#" maxrows="20" >
                 select   distinct     discs.title
                  from        discs
                  where        title like '#arguments.search#%'
                  order by    title
              </cfquery>
             <!--- And return it as a List --->
              <cfreturn  valueList(results.title) >
          </cffunction>
            <!--- Lookup used for auto suggest --->
            <cffunction name="find_artist" access="remote" returntype="string">
              <cfargument name="search" type="any" required="false" default="">
              <!--- Query discs --->
              <cfquery name="results" datasource="#dsn#" maxrows="20" >
                 select   distinct     discs.artist
                  from        discs
                  where       artist like '#arguments.search#%'
                  order by    artist
              </cfquery>
             <!--- And return it as a List --->
              <cfreturn  valueList(results.artist) >
          </cffunction>
       </cfcomponent>

  • CFSELECT  bind to cfc

    I copied the cfm and cfc code directly from livedocs for
    CFSELECT. When I run it, nothing happens.
    When I view the javaScript console I see the error
    _31c has no properties in file
    CFIDE/scripts/ajax/package/cfajax.ja line:1264
    Which is :
    if(typeof
    (_31c.length)=="number"&&!_31c.toUpperCase){
    The ajax debug console has this:
    info:http: CFC invocation response:
    info:http: HTTP GET
    /com/form.cfc?method=getMarkets&returnFormat=json&argumentCollection=%7B%22pPropertyType% 22%3A%22ind%22%7D&_cf_nodebug=true&_cf_nocache=true&_cf_clientid=040CA886EBC6022C6B3CF49B5 7FAC070&_cf_rc=0
    info:http: Invoking CFC: /com/form.cfc , function: getMarkets
    , arguments: {"pPropertyType":"ind"}
    info:LogReader: LogReader initialized
    info:global: Logger initialized
    BTW: I copied the /CFIDE/scripts directory to the webroot
    where I am working, I have checked that all of the included js
    files are present.
    Any ideas?

    i wouldn't call that a solution though, if you have a header within your onRequest, now you have to manually add it to all your pages!

  • CFGRID bind problem

    Hi, I have a problem with binding fields to a cfgrid.
    When I'm populating my grid using the query attribute the
    binding is not working. The problem is the accessing a row's cell;
    myGrid.selectedItem object exists but when I use
    myGrid.selectedItem.columnname nothing returns.
    Howerever when I use the same code and I populate the grid
    manually or via a loop in cfgridrow the code is working. (commented
    in code)
    Now the second option seems to be a solution but...
    when a db column is empty cf is not populating the column
    with an empty value but just takes the next data available from the
    list in the data attribute
    Anyone experienced this anoying problem before and could help
    me with a solution ?
    Thanks for your help!
    Here the code:
    [hi]
    <cfgrid query="query" name="myGrid" rowheaders="no"
    selectmode="row">
    <cfgridcolumn name="lname" header="Lastname" />
    <cfgridcolumn name="fname" header="Firstname" />
    <!--- <cfloop query="query">
    <cfgridrow data="#lname#,#fname#" />
    </cfloop> --->
    </cfgrid>
    <cfinput type="text" name="firstName" label="First Name:"
    bind="{myGrid.selectedItem.fname}" />
    [/hi]
    PS. forgot to mention that we're running on a CF 7.0.1

    This was a tricky one for me also, but it is a simple fix.
    When using a query, the myGrid.selecteItem.columnName is case
    sensitive, and it HAS to match the column name in your query SELECT
    statement.
    Look at the code below for an example.
    If you are using a SELECT * SQL statement, then your grid
    selectedItem column name HAS to match your DB spelling.
    <cfquery name="x"
    datasource="#application.datasource#">
    SELECT
    Orderid, CustomerID <!--- case of column names has to
    match your selectedItem column name --->
    FROM Orders
    </cfquery>
    <cfform name="y" format="flash">
    <cfgrid query="x" name="myGrid" rowheaders="no">
    <cfgridcolumn name="ORDERID" header="Order" /><!---
    notice all uppercase in name, matches --->
    <cfgridcolumn name="CUSTOMERID" header="Customer" />
    </cfgrid>
    <cfinput type="text" name="cID" label="Customer"
    bind="{myGrid.selectedItem.CustomerID}"/>
    <!--- notice the case matches SELECT statement
    Changing the case of any letter in the bind or in the select
    sql will cause your binding to not work.
    --->
    </cfform>

  • CFGRID, was working in CF8 won't display results in CF11

    Hi
    I recently upgraded a client from CF 8 to CF 11.
    In the code is a CFGRID which was working in CF8 but now in CF11 the grid displays but no data appears (the grid is simply empty).
    With debugging enabled the Coldfusion Ajax Logger is reporting the following error:
    Uncaught SyntaxError: Unexpected identifier (http://hiddenServer.com/index.cfm?action=job.manageJobOperations&jobId=2395&cfdebug, line 104)
    Line 104 is the "</cfgrid>" tag.
    Here is cfgrid code, complete with it's bound cfselect statement immediately before it:
    <cfselect name="primarysupplier" query="getconcretecompanies" display="name" value="id" required="yes"  />
    <cfgrid name="mixdesigns" format="html" bind="cfc:controller.Controller.getMixDesign({primarysupplier},{cfgridpage},{cfgridpagesize},{c fgridsortcolumn},{cfgridsortdirection},{primaryconcrete:jobid})" bindonload="yes" height="400" selectmode="row" sort="yes" selectonload="false">
                                <cfgridcolumn name="id" display="no" />
                                    <cfgridcolumn name="selectcode" select="yes" display="yes" header="Select" width="40" />
                                    <cfgridcolumn name="shortcompanyname" display="yes" header="Supplier" width="75" select="no" />
                                    <cfgridcolumn name="mixnumber" display="yes" header="Mix Number" width="75" select="no" />
                                    <cfgridcolumn name="psistrength" display="yes" header="PSI" width="45" select="no" />
                                    <cfgridcolumn name="cubicyardprice" display="yes" header="Price" width="50" select="no" />
                                    <cfgridcolumn name="description" display="yes" header="Description" width="180" select="no" />
                                </cfgrid>
    I've dumped the query that populates the cfselect and there are no empty rows.
    The console at the bottom of Chrome simply reports the same error, "Uncaught syntaxError. Unexpected identifier".
    Has anyone else encountered this issue? If nothing else I'd love to learn how to debug this error, it seems as if there is some extra data being fed to the cfgrid but I can't seem to trap it....
    Anyone?
    Thanks in advance for your help,
    Rich

    Anit
    Could you please clarify?
    In the Adobe bug report for this issue (Bug#3759630 - CFGRID with BIND to CFC failed for an incorrect JavaScript)
    ... it mentions
    Build
    Found In Build
    CF11_Final
    Fixed In Build
    289972
    Doesn't that mean if the Coldfusion version that I'm running is Coldfusion version 11,0,0,289974, then my build would already have the fix rolled up in it? Or am I not reading the versioning correctly?
    Thanks,
    Rich

  • CFGRID Item No.

    i have this cfgrid program and i want to put the item no. in the table but its not working... please help...
        <cfgrid format="html"
                    name="maingrid"
                      bind="url:cfc/user.cfm?page={cfgridpage}&pageSize={cfgridpagesize}&sortCol={cfgridsortcol umn}&sortDir={cfgridsortdirection}&staff_emp=#staff_emp#&start_date=#start_date#&end_date= #end_date#&txtuserid=#txtuserid#&company1=#company1#"
                    preservepageonsort="true"
                    appendkey="no"           
                    selectonload="false"
                    width="750"                           
                    style="clear:both;" colheaderalign="center" striperows="yes"
                    >   
                   <cfset l_pos=1>
                    <cfset l_posit=1>                                        
                    <cfgridcolumn name="chuva" header="<center>NO.</center>" width="30"/>               
                    <cfset chuva=l_posit+1>          
                    <cfgridcolumn name="datatime" header="<center>DATE</center>" width="100"/>
                    <cfgridcolumn name="status" header="<center>STATUS</center>" textcolor="##FF0000" width="100"/>
                    <cfgridcolumn name="timeindatetime" header="<center>TIME IN</center>" width="100" />
                    <cfgridcolumn name="timeoutdatetime" header="<center>TIME OUT</center>" width="100"/>
                    <cfgridcolumn name="dayconworkhrs" header="<center>CONTRACT HRS</center>" width="100"/>
                    <cfgridcolumn name="daytotalreghrs" header="<center>TOTAL HRS</center>" width="75"/>       
                    <cfgridcolumn name="daytotalothrs" header="<center>OVERTIME</center>" width="75" />
                    <cfgridcolumn name="DayTotalUndertime" header="<center>UNDERTIME</center>" width="75" select="yes"/>               
                </cfgrid>
            </cfform>
    output is:
    NO.
    Datatime
    status
    timeindatetime
    timeoutdatetime
    dayconworkhrs
    daytotalreghrs
    daytotalothrs
    daytotalundertime
    C
    C
    C
    based on my program all the columns is working but the NO. column is not appearing i want to put some item no. there in every rows... like 1...2...3.... and so on.. please help... thanks!

    Hi,
    refer
    http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p51.htm
    If grid uses a query, column name must specify name of a query column.

  • Work around for Application.cfc

    I have an Application.cfc file that outputs a header and footer page for every request.  That works wonderful but if I try to open a page that is doing a <cfgrid> using a CFC file than I get an error of "Error invoking CFC /GATS/CFC/purchaseOrder.cfc : Internal Server Error [Enable debugging by adding 'cfdebug' to your URL parameters to see more information]" when opening the page.
    Commenting out the header/footer include in the Application.cfc file lets the <cfgrid> populate with the CFC file.  Is there a fix or work around for this?
    Application.cfc file
    <cfcomponent output="false">
    <cffunction name="onRequestStart" returnType="boolean" output="true">
          <cfargument name="thePage" type="string" required="yes">
         <cfset PageName = GetFileFromPath(thePage)>
        <cfif not IsDefined("session.user.isAuthenticated") or
              session.user.isAuthenticated equal session.no>
          <cfif FindNoCase('index.cfm', PageName) is not 0>
            <cfelse>
              <cfset session.messages[1] = "Authentication required.">
              <cflocation url="#application.WebAddress#" addtoken="no">
          </cfif>
        </cfif>
        <cfif FindNoCase('index.cfm', PageName) is not 0>
          <cfset request.PageNavigation = "">
          <cfset request.Screen = "Login">
        </cfif>
        <cfif FindNoCase('mainMenu.cfm', PageName) is not 0>
          <cfset request.PageNavigation = "Home">
          <cfset request.Screen = "">
        </cfif>
        <cfif FindNoCase('purchaseOrder.cfm', PageName) is not 0>
          <cfset request.PageNavigation = '<a href="mainMenu.cfm">Home</a> &##8226; New Purchase Order'>
          <cfset request.Screen = "">
        </cfif>
        <cfif FindNoCase('logout.cfm', PageName) is not 0>
          <cfelse>
            <cfinclude template="includes/header.cfm">
        </cfif>
        <cfreturn true>
      </cffunction>
    <cffunction name="onRequestEnd" returnType="void" output="true">
          <cfargument name="thePage" type="string" required="yes">
        <cfset PageName = GetFileFromPath(thePage)>
        <cfif FindNoCase('logout.cfm', PageName) is not 0>
          <cfelse>
            <cfinclude template="includes/footer.cfm">
        </cfif>
      </cffunction>
    </cfcomponent>
    purchaseOrder.cfm
    <cfgrid name="AccountGrid" format="html" bind="cfc:GATS.CFC.purchaseOrder.GetQuantities({cfgridpage},{cfgridpagesize}, {cfgridsortcolumn}, {cfgridsortdirection})">
      <cfgridcolumn name="ID" header="ID" display="yes">
      <cfgridcolumn name="vendor_name" header="Name" display="yes">
    </cfgrid>
    I found this on the web:
    That error is due to our application.cfm having a single HTML comment at the
    start of the file. Apparently if your Application.cfm or Application.cfc file
    outputs ANYTHING, binds to CFCs with AJAX (via HTML CFGRID or CFAJAXPROXY, for
    example) do not work. The CFC will be called, but the data from it will never
    "flow" into the CFGRID. Removing the comment from the Application.cfm file took
    care of our CFGRID issue.
    This there a way to have an Application.cfc file that displays a header and footer for every page and have and
    have a page have a <cfgrid> in it?

    BKBK,
    I created the examples you posted and commenting out the header/footer lines in my Application.cfc displayed the cfgrid results (updating the query to a table I had).  Running the same example code with the header/footer included in the Application.cfc would not show the cfgrid results.
    I attached the Application.cfc file for review.
    Couldn't attach the file.
    Application.cfc
    <cfcomponent output="yes">
      <cfset this.name = "GATS">
      <cfset this.clientmanagement = "true">
      <cfset this.applicationtimeout = CreateTimeSpan("0","0","20","0")>
      <cfset this.sessionmanagement = "true">
      <cfset this.sessiontimeout = CreateTimeSpan("0","0","20","0")>
      <cfset this.scriptProtect = "true">
      <cfparam name="session.yes" default="Yes">
      <cfparam name="session.no" default="No">
      <cffunction name="onApplicationStart" returnType="boolean" output="no">
        <cfset application.Directory = "/GATS/">
        <cfset application.Datasource = "IA-webapplications">
        <cfset application.DatasourceGATS = "SBS-GATS">
        <cfreturn true>
      </cffunction>
      <cffunction name="onApplicationEnd" returntype="void" output="no">
        <cfargument name="ApplicationScope" required="yes" />
      </cffunction>
      <cffunction name="onSessionStart" returntype="void" output="no">
        <cflock scope="session" timeout="5" type="exclusive">
          <cfset session.no = "No">
          <cfset session.yes = "Yes">
          <cfset session.new = "New">
          <cfset session.user = StructNew()>
          <cfset session.user.isAuthenticated = session.no>
          <cfset session.user.emplid = ""> 
          <cfset session.user.userSSOId = "">
          <cfset session.user.firstName = "">
          <cfset session.user.lastName = "">
          <cfset session.user.name = "">
          <cfset session.messages = ArrayNew(1)>
          <cfset session.savedInputValues = ArrayNew(1)>
          <cfset session.filesTransferred = "">
        </cflock>
      </cffunction>
      <cffunction name="onSessionEnd" returntype="void" output="no">
        <cfargument name="SessionScope" required="yes">
        <cflock scope="session" timeout="5" type="exclusive">
          <cfset Arguments.SessionScope.user.isAuthenticated = session.no>
          <cfset Arguments.SessionScope.users.emplid = ""> 
          <cfset Arguments.SessionScope.user.userSSOId = "">
          <cfset Arguments.SessionScope.user.firstName = "">
          <cfset Arguments.SessionScope.user.lastName = "">
          <cfset Arguments.SessionScope.user.name = "">
        </cflock>
      </cffunction>
      <cffunction name="onRequestStart" returntype="void" output="yes">
        <cfargument type="String" name="TargetPage" required="yes">
        <cfset PageName = GetFileFromPath(TargetPage)>
        <cfif not IsDefined("session.user.isAuthenticated") or
              session.user.isAuthenticated equal session.no>
          <cfif FindNoCase('index.cfm', PageName) is not 0>
            <cfelse>
              <cfset session.messages[1] = "Authentication required.">
              <cflocation url="#application.WebAddress#" addtoken="no">
          </cfif>
        </cfif>
        <cfif FindNoCase('index.cfm', PageName) is not 0>
          <cfset request.PageNavigation = "">
          <cfset request.Screen = "Login">
        </cfif>
        <cfif FindNoCase('mainMenu.cfm', PageName) is not 0>
          <cfset request.PageNavigation = "Home">
          <cfset request.Screen = "">
        </cfif>
        <cfif FindNoCase('purchaseOrder.cfm', PageName) is not 0>
          <cfset request.PageNavigation = '<a href="mainMenu.cfm">Home</a> &##8226; New Purchase Order'>
          <cfset request.Screen = "">
        </cfif>
        <cfif FindNoCase('logout.cfm', PageName) is not 0>
          <cfelse>
            <cfinclude template="includes/header.cfm">
        </cfif>
      </cffunction>
      <cffunction name="onRequestEnd" returntype="void" output="yes">
        <cfargument type="String" name="TargetPage" required="yes">
        <cfset PageName = GetFileFromPath(TargetPage)>
        <cfif FindNoCase('logout.cfm', PageName) is not 0>
          <cfelse>
            <cfinclude template="includes/footer.cfm">
        </cfif>
        <cfif FindNoCase('sessionTerminated.cfm', PageName) is not 0>
          <cfinvoke method="onSessionEnd">
            <cfinvokeargument name="SessionScope" value="#session#">
          </cfinvoke>
        </cfif>
      </cffunction>
      <cffunction name="onError" returnType="void" output="no">
        <cfargument name="exception" required="true">
        <cfargument name="eventName" type="string" required="true">
        <cfthrow object="#arguments.exception#">       
      </cffunction>
    </cfcomponent>

  • CFC Init problem

    I'm trying to create a cfc in my application scope but the
    variables I set in the init method don't seem to be persistent.
    Here is the init method:
    <cfcomponent displayname="coupons" hint="Checks validity
    and type of coupon and applies it to order."> <cffunction
    name="init" access="public" output="false" returntype="coupon">
    <cfargument name="ds" required="true" type="string" <cfset
    variables.ds=arguments.ds> <cfreturn this>
    </cffunction>
    Here's the call in the Application.cfc
    <cfset Application.coupons = createObject("component",
    "coupon").init(application.admin.ds)>
    Here is the method that throws the "variables.ds not defined
    error"
    <cfstoredproc procedure="pr_getCouponList"
    datasource="#variables.ds#" debug="Yes"> <cfprocparam
    type="In" cfsqltype="CF_SQL_INTEGER" dbvarname="@Active"
    value="#arguments.Active#" null="No"> <cfprocparam type="In"
    cfsqltype="CF_SQL_VARCHAR" dbvarname="@Sort"
    value="#arguments.gridSortColumn#" null="No"> <cfprocresult
    name="getCouponList" resultset="1"> </cfstoredproc>

    On Tue, 24 Jun 2008 05:22:30 +0000 (UTC), athanasiusrc wrote:
    > Okay, I figured out the problem but don't know the
    answer. I am getting this
    > problem when I try to bind the cfc in a grid because the
    grid is binding a new
    > copy of the cfc instead of the one created in the
    application scope:
    >
    > <cfgrid format="html" name="getCouponList"
    pagesize="#attributes.pageSize#"
    > selectmode="row"
    >
    >
    bind="cfc:cfcs.coupon.getCouponList({cfgridpage},{cfgridpagesize},{cfgridsort
    > column},{cfgridsortdirection},{active})">
    >
    > It works if I call it through an invoke command.
    >
    > The problem I have now is, how can I bind a cfc in a
    scope?
    I'm not sure how to use a variable instead of a CFC in a bind
    statement (I
    don't do much UI type development, so have never needed to
    know); however
    your init() method in your CFC could look to see if there's
    an instance of
    itself in the application scope and if so return that instead
    of a new
    instance of itself. Then you chain your method call thus:
    cfcs.coupon.init().getCouponList(etc...)
    Adam

  • CF8 CFGRID and CheckBox Not Working

    Hi,
    I am using CF 8. I have a HTML data grid using <cfgrid
    format="html">, I am trying to put a checkbox as the first
    column of the grid. I was told I could use something like:
    <cfgridcolumn type="boolean" header="Remove"
    name="remove" />
    The checkbox still doesn't show up. Any idea why?
    I am using the "bind" attribute of the cfgrid tag. It is
    bound to a CFC. I doubt that matters but thought I would mention
    it.
    Any help appreciated
    -Westside

    use selectmode attribute, for example,
    <cfgrid name="gr" format="html" selectmode="edit">

  • CFGRID search

    I have a cfgrid with cfc binding. Also I have an cfinput box to filter the grid records by passing the cfinput box id in curly braces along with the bind expression in the cfgrid tag. The cfc method to get the grid data refers some session variables. The search works only within the session timeout period. If user search after session timeout period it throws javascript exception. I tried onKeyUp of cfinput I checked the session timeout and if it is true then refresh the grid otherwise alert the user saying your session is time out. However this doesn't work for me.  Please help me on this

    Do for a start:
    <cfinput> in place of <input>
    <cfselect> in place of <select>
    </cfform> in place of <form>

  • Error Invoking CFC... but it's there! I see it!

    Greetings all -
    I'm hoping someone can help explain why this following attempt at binding a CFC is not working:
    1. I set up a CF Server Mapping to my cfc folder:
    Logical path = /testcfc
    Physical path = E:\ColdFusion8\Components\testcfc
    2. I set up a virtual directory to my cfc folder:
    Virtual path: /testcfc
    Physical path: E:\ColdFusion8\Components\testcfc
    3. If I use CFINVOKE to call the CFC, it works as expected.
    <cfinvoke component="testcfc.testRequests" method="get_Clients" returnvariable="var">
    <cfinvokeargument name="fiscal_year" value="#year(now())#">
    </cfinvoke>
    <cfdump var="#var#">
    4. If I attempt to bind the CFC, I get the error "Error Invoke CFC /testResults.cfc: Not Found"
    <cfselect name="tstClientID" id="tstClientID" bind="cfc:testcfc.tstRequests.get_Clients('#year(now())#')" bindonload="true" value="client_id" display="client_name" />
    Debugging the error, I see that CF is attempting to find the CFC in the root directory of the app... it is disregarding the directory path ("testcfc") specified entirely. Why??
    The bizarre thing is, I've set up the same structure on my PC/dev environment, and it works fine.
    How can I further debug this issue? It's got to be a mapping problem, but can;t see what I've done wrong. Any help truly appreciated!
    Doug

    I recently stumbled upon this post:
    http://www.codersrevolution.com/index.cfm/2008/9/10/ColdFusion-CFC-Binding-Ajax-Proxy-and- Updater-1#comments
    Sure enough, my prod environment is running 8.0.0. I'm going to apply to apply the patch to 8.0.1 and see if that corrects the issue. I hope.
    Doug

  • Ajax cfc issue -- indeterminent error msg

    I have one ajax cfc app that works fine.  This app uses the file name from the browse button on the file input object that is passed to my proxy.cfc, which in turn, queries the attachments table in my db to see if this file has already been uploaded for this project.  If the file is not there, then I upload it to the server.  If it is there, I pop-up an error message to the user giving him/her the date/time it was uploaded and by whom.  These values are returned by testing code in the cfc.   It works great.
    I am now working on another app that will populate a lower-order select box in a hierarchy of select boxes based upon the new value in the current select box that has just been selected.  It seems doable, but there is an immediate error that I cannot seem to get past an error thrown by the IE error handler as an unhandled error.  This error is a “throw msg” error within the core Adobe code, which I’ve pasted in below:
    I have modeled the new app after the one that I have working.  In a effort to figure out this cause of this problem, I have even housed it in the original proxy.cfc to eliminate any question about having it in the correct location on the server. 
    At the current point, I am only trying to return an input value from the app, getAreasRmt.  Here are the calling and called code.  The line in the calling code that generates the error is the one where I call the cfc function: “alert (‘Rtnd BuGrpID: ‘ + areaProxy.getAreasRmt(….)));”
    Calling JS:
    getAreasRmt:
         This code will eventually pass back a structure containing all of the areas whose Business Group ID is sBuGrpID. 
         I am running CF8 on a W2003 x64 server with IIS 6.0.
         Thanks in advance for any help/suggestioins.
    Len

    Folks,
    This is my first attempt to bind a CFC to a <cfselect> so I may be missing something very basic that everyone elses knows.
    I've made some progress on this issue, but I'm not sure I'm actually moving forward.   After Googling, reviewing CF8 books and searching this site, I have converted this over to binding my CFC to a <cfselect>, which then calls the procedure within the cfc.  I've also started using cfdebug and FireBug from time to time to try to gain some insight into what is happening.
    But I think that I'm just at a different form of the original error message.  Here is the error from the Ajax Debug Log window:
    window:global: Exception thrown and not caught (http://192.168.1.100/CFIDE/scripts/ajax/package/cfajax.js, line 798) [Note: 798 could be the loction of the original error.  Or not]
    info:http: CFC invocation response:{"COLUMNS":["LOCATIONNAME","LOCATIONID"],"DATA":[["CDPG BOARDS",1],["CDPG Boxed Processor",12],["DIJIC",13],["EPSD BOARDS",2],["EPSD SYSTEM",3],["KM-RDV",4],["LAD",5],["MCPD",6],["MWG",7],["New BOARDS",9],["NEW_BIZ-RDV",11],["NPG",10],["OPD",8],["TestBus",14],["Testing ",15]]}
    info:http: HTTP GET /PHREDsevenInternal/Templates/hierchy.cfc?method=getLocs&returnFormat=json&argumentCollec tion=%7B%7D&_cf_nodebug=true&_cf_nocache=true&_cf_clientid=999030C7709D5E20E12A17ED431EFB2 A&_cf_rc=0
    info:http: Invoking CFC: /PHREDsevenInternal/Templates/hierchy.cfc , function: getLocs , arguments: {}
    info:LogReader: LogReader initialized
    info:global: Logger initialized.
    It is returning the query from the CFC finally. I'm assuming that if there would not have been an error, then the query would have been loaded into the <cfselect> that called it.
    Here is the latest version of both sides of the cfc binding:
    Call side:
    <cfselect bind="CFC:hierchy.getLocs()" bindonload="true" value="LocationID" display="LocationName" name="Location" />
    Here is the CFC code:
    <cfcomponent output="false">
    <!--- Test to see if the passed-in name is in the db already --->
    <cffunction name="getLocs" access="remote" returntype="query">
      <cftry>
        <cfquery name="getLocQry" datasource="PHREDsevenInternalSQL">
         SELECT LocationName,LocationID
         FROM Locations
         ORDER BY LocationName
        </cfquery>
        <cfcatch type="Any">
         <cfdump var="#getLocQry#">
        </cfcatch>
      </cftry>
      <cfreturn getLocQry>
    </cffunction>
    </cfcomponent>
    Question about location of the CFC.  I prefer to keep all my CFC's in a CFC directory so that they can be reuseable.  I tried both relative and full location methods but neither worked.  If it didn't find the CFC, then it would throw an error telling me that it didn't find it, but I could not get the query to run and return the info you see above until I moved it into the directory where the calling cfm lives.  Is there some mystical/magically method for letting CF know where it is if it isn't in the invoking directory?  I know that if I were invoking a CFC that I would have to use the full path dotted method.   I actually did that here but it didn't get me a result back.  It just told me that I needed to return a 2D arrary or serialized query, which told me that I wasn't actually running the query even though CF could not find it.  Or I think that is what it meant.
    I'm at a total loss as how to proceed.  I've spent 4 days on this now and need to get this issue resolved.
    Thanks again for any suggestions/help on this matter.
    Len

  • Cfselect not showing cfc bound data

    I have a CFC that works fine. I can access it directly and get data etc. I even have it working find on another server with the same datasource. I am binding the cfc to a cfselect like so.
    <cfform>
    <cfselect name="category" bind="cfc:cfc.GetCategory.getCategory()" bindonload="true"></cfselect>
    </cfform>
    My cfc is located in a directory name cfc. The name is GetCategory.cfc and the method is getCategory. I an access it fine by goign to the URL as so.
    http://siteurl/cfc/GetCategory.cfc?method=getCategory
    It displays the data fine.
    However when I try to look at the page the cfselect is on it shows me an empty drop down box with no selections. I can see using the cfdebug in the url that the cfc is being executed properly and returning data. It is just not showing up in the drop down. I have been banging my head against this one for a few days now so any outside eyes would be helpful. Anybody else run into this issue where the cfc works fine but does not appear to be binding to the cfselect for whatever reason? Keep in mind this code is working fine on another CF9 machine with a very similar setup.

    Hedge-nfylYo wrote:
    Ok I found something else interesting. I don't know what it means but maybe somebody here does. Here is a screenshot from both sites.
    The one that is NOT working.
    I noticed on the one that is working there is an additional checkbox at the bottom of the debugger screen for bind (I circled it in red) and on the site where the controls do not appear to be binding there is no such checkbox. I would think this leads weight to my idea that for whatever reason on the top screenshot the data is not being binded to the cfselect controls for some reason. The code is exactly the same. The databases are exactly the same. The only difference here is servers. Does this give any ideas?
    The data appears to be coming in, so this should work. Furthermore, I see that the data represents an array of dimension [n][2], which is equivalent to a two-column result set, hence equivalent to a query. That's yet another reason why it should work.
    Take a look at the following modified version of the example I gave earlier. It might contain themes relevant to your case.
    Employee.cfc
    <cfcomponent output="false">
    <cffunction name="getEmployee" access="remote" output="false" returntype="array">
    <cfset var getAllEmployees = queryNew("","")>
    <cfset var arr = arrayNew(2)>
    <cfquery name = "getAllEmployees" dataSource = "cfdocexamples">
        SELECT Emp_ID,  FirstName || ' ' || LastName as Name
        FROM Employees
    </cfquery>
    <cfloop query="GetAllEmployees">
    <cfset arr[currentrow][1]=emp_id>
    <cfset arr[currentrow][2]=name>
    </cfloop>
    <cfreturn arr>
    </cffunction>
    </cfcomponent>
    selectEmployee.cfm
    <cfform>
    <cfselect value="emp_id" display="name" name="employee" bind="cfc:Employee.getEmployee()" bindonload="true"></cfselect>
    </cfform>

Maybe you are looking for

  • Server does not recognize my email address

    when i try to email something i get an error message that says the server does not accept my email address ?? any ideas

  • Can't see my Oracle stored procedure in the avalable data source list

    Post Author: Moori CA Forum: Data Connectivity and SQL Hello All, I've created an Oracle stored procedure which I need to use it's returned data in my crystal report but I can't find it in the data source list. I'm using the same schema & database an

  • Where are  iCal files in Leopard?

    I've looked at the files in ~/Library/Application Support/iCal but none of them have a date greater that the date I converted to Leopard. As a result my backup program (not Time Manager) is not backing iCal up to my external HD. Anyone know where the

  • PC : How can we summarize the email notification

    Hi , In the Process chain after the Data load is complete we need to send an automated email notification . This email has to say that " THE DATA LOAD IS COMPLETE " . Along with this message I am getting the LOG FOR THE PROCESS and LOG FOR RESPECTIVE

  • Exporting Job details

    How can I export all the Jobs definition along with the start and end time into an excel? When I am clicking on Jobs(Definition) -->Export , its exporting the job log not the jobs and details.