I have tested this using a recent nightly build and it does work, just
ensure the "access" on your CFFUNCTION is indeed "remote" or calls in
that manner may fail.
HOWEVER, I should point out I don't often see this used because a form
submission as you described is pretty much a redirection of the browser
with the data, thus in this case the browser will hit a CFC function for
its next markup page, and since your function has [returnformat="json"],
I'd guess its not going to get markup. The browser would actually show
the JSON string (whatever returns from your function) unless you have a
plan to make that function again perform a redirection to somewhere else
when you have run your CF code, but its a little messy.
A far more common scenario is have the form action="" (redirects with
the data to the current page). Then in the top of your html page, you
detect the form data, call your CFC (perhaps all in a CFSILENT), run
whatever CF code you need then redirect on that page if it all passes
(and if it fails the user can just be shown the same page and you can
even CFIF to show an error message).
Another alternative is all in JS, onSubmit show a nice loader, run your
CFC call with an AJAX request and when it returns either redirect using
JS or show a message etc (with no need for redirecting at all if it fails).
Thats my thoughts on form submission, hope it helps.
Jamie.
On 08/10/2012 18:44, Jason Allen wrote:
If you have a form, and unSubmit you post it to a CFC, do the form
variables get interpreted as arguments?
For instance, say I have a form with the following variables that a
user can put in, and I post it to the cfc, do they variables get
interpreted as the arguments for the cfc?
form.userID
form.firstName
form.LastName
form.email
<cffunction name="checkUserCredentials" returntype="struct"
output="no" access="remote" returnformat="json">
<cfargument name="userID" type="string" required="false" default=""
hint="user id" />
<cfargument name="firstName" type="string" required="false" default=""
hint="user first name" />
<cfargument name="lastName" type="string" required="false" default=""
hint="user last name" />
<cfargument name="email" type="string" required="false" default=""
hint="user email" />
</cffunction>
--
online documentation: http://openbd.org/manual/
http://groups.google.com/group/openbd?hl=en
--
aw2.0
http://www.aw20.co.uk/
--
online documentation: http://openbd.org/manual/
http://groups.google.com/group/openbd?hl=en