Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
schep #1
How to get results from cfc method used as Form Action
I'm collecting a value in a form field that I want to use a parament to a cfc
method that performs a query and then returns data for formating on the calling
(form) page. The Form action is a cfc name with the desired method indicated
in a hidden Input field as described in the documentation. What I can't
figure out is how to "capture" the query results that are returned by the
method to the calling page that contains the form.
What happens is (even though I have output=false in the cfc and output=no in
the method) the cfc dumps the returned data and there is no return to the
calling form.
All of the examples I've found have the cfc formatting the output - which is
not recommended as best practice. Can anyone give me clue or point to some
releavant example code? BTW i'm using MX6.1 - thanks!
I can think of some ways to workaround this but they all seem kinda squirrely
- maybe I'm missing some basic fact. It seems like Macromedia surely must
have some examples of "best practices for calling a cfc from a form, have the
cfc return data to the calling page where it is formatted for presentation"
schep Guest
-
Problem accessing results from DataService fill method
I've set up an application that gets data from a data service configured with a java-dao adapter. If I define a DataGrid with the array populated... -
CF submit form action
hi. I have a site that uses a form for visitors to request information. when the SUBMIT button is clicked, the page returns to the home page... I... -
can't create action/droplet that doesn't put results on desktop
I am ready to pull my hair out..... I am trying to create an action, and/or droplet, that will put the results in a designated folder, or even... -
Form action problem
Trying to fix a web site I inherited. Problem is with the *help* page. User fills out form and hits send. The browser comes back with Error... -
form action
What does "doesn't seem to work" mean? (asp.general removed from x-post list) "rOadhOg" <roadhog@nospam.phreaker.net> wrote in message... -
billee #2
Re: How to get results from cfc method used as FormAction
Hi Schep,
Not sure about best practices, but all of a CFCs variables are available
internally through the THIS scope. so if you have a function named "getQuery,"
you return the values as shown in the code listing that follows.
If you need to convert the query to a structure, you can change the returntype
to struct and loop over the query to populate structure keys and return the
structure to the calling page.
<cffunction name="getQuery" returntype="query" output="false">
<cfargument name="formArguments" required="true"/>
<cfquery datasource="#variables.DSN#" name="qryProcForm">
SELECT...
</cfquery>
<cfreturn qryProcForm>
</cffunction>
<!--- calling page just returns the results --->
Hope this helps! :)
billee Guest
-
schep #3
Re: How to get results from cfc method used as FormAction
hi billee - thanks! I had missed that about being able to reference "this"
scope from the page that invoked the component method. - I also discovered
why I couldn't "capture" the object returned from a component method when using
referencing components directly from the Form "Action" attribute - this reason
is that you can't! Here's quote from docs: Clients can directly call CFC
methods using a URL or by submitting form fields. In these cases .the CFC
method is responsible for generating all HTML that is returned to the client
...thanks for getting me back on track with "this" scope!
schep Guest



Reply With Quote

