1

我有一个绑定到远程 cfc 的 cfselect 语句。它将表单中另一个元素的值传递给 cfc 以填充 cfselect。我在启用 cfdebug 的情况下运行此代码,它似乎工作正常,但我发现如果我没有启用 cfdebug,则不会填充任何内容。我没有收到任何其他我知道的错误,我已经在 chrome 和 mozilla 中尝试过 - 同样的问题。

这是我的cfselect:

<cfselect name="intlRepID" id="intlRepID" required="yes" value="userID" display="businessName" bind="cfc:nsmg.extensions.components.user.getIntlRepRemote({programID})" bindonload="true" />

这是我的远程功能:

<cffunction name="getIntlRepRemote" access="remote" returntype="array" output="false" hint="Gets a list of Intl. Reps. assigned to a candidate">
    <cfargument name="programID" default="" hint="Get Intl. Reps. Based on a list of program ids">

    <cfscript>
        // Define variables
        var qGetIntlRepRemote='';
        var result=ArrayNew(2);
        var i=0;
    </cfscript>

    <cfquery 
        name="qGetIntlRepRemote" 
        datasource="#APPLICATION.DSN#">
            SELECT
                u.userID,
                u.businessName
            FROM 
                smg_users u
            INNER JOIN
                smg_students s ON s.intRep = u.userID
            WHERE
                s.companyid = <cfqueryparam cfsqltype="cf_sql_integer" value="#CLIENT.companyid#">
            <cfif LEN(ARGUMENTS.programID)>
                AND 
                    s.programID IN ( <cfqueryparam cfsqltype="cf_sql_integer" value="#ARGUMENTS.programID#" list="yes"> )
            </cfif>
            AND
                s.active = <cfqueryparam cfsqltype="cf_sql_integer" value="1">
            GROUP BY
                u.userID
            ORDER BY
                u.businessName
    </cfquery>

    <cfscript>
        // Add default value
        result[1][1]=0;
        result[1][2]="---- All - Total of " & qGetIntlRepRemote.recordCount & " International Representatives ----" ;

        // Convert results to array
        For (i=1;i LTE qGetIntlRepRemote.Recordcount; i=i+1) {
            result[i+1][1]=qGetIntlRepRemote.userID[i];
            result[i+1][2]=qGetIntlRepRemote.businessName[i];
        }

        return result;
    </cfscript>
</cffunction>
4

0 回答 0