Right I understand that.

But with a Bind expression, you want only a single value returned.  I
got my code to work, but had to create these functions, and modify my
form like...

<cfform name="frmList">
<cfinput name="txtSearch" type="text" value="">
<cfinput name="txtResult" type="text"
  bind="cfc:mg.RemotingService.executeBindEvent
(eventName='cservice.search', values={txtsea...@keyup})">
</cfform>

The RemotingService has this new function,

<!--- pass in your values is name=value pairs to the function, all are
passed as the
                        arguments structure to the super.executeBindEvent() --->
<cffunction name="executeBindEvent" output="false" access="remote"
returntype="any">
        <cfargument name="eventName" type="string" required="true" />
        <cfargument name="returnValue" type="string" required="false"
default="result" />

        <cfreturn super.executeBindEvent(arguments.eventName, arguments,
arguments.returnValue) />
</cffunction>


In AbstractRemotingService.cfc I added this function,

<cffunction name="executeBindEvent" output="false" access="remote"
returntype="any">
  <cfargument name="eventName" type="string" required="true" />
  <cfargument name="values" type="struct" required="false"
default="#StructNew()#"/>
  <cfargument name="returnValue" type="string" required="false"
default="result" />
  <cfset var local = StructNew()/>

        <!--- For Javascript post calls to the service --->
        <cfif cgi.request_method eq "post">
                <cfset arguments.values = duplicate(form)/>
        </cfif>

        <cfset local.event = getModelGlue().executeEvent
(argumentCollection=arguments) />

        <cfset local.result = local.event.getValue(returnValue) />

        <cfset resetCFHtmlHead() />
        <cfreturn local.result />
</cffunction>

At the moment, the form just echo's the typed text via my controller's
code, but it could be made to do lookups in the database which is to
come and via a bind to a cfgrid.  More testing to come.

Just try my code, its self explanatory.  If what I've done can be done
with existing MG code let me know, but I can't use a struct in a
<cfinput> bind expression and I can't use a struct in the return value
either.
-- 
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog

You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en

Reply via email to