• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Form to CFC directly

Contributor ,
Feb 08, 2007 Feb 08, 2007

Copy link to clipboard

Copied

Is it possible to have a form call a CFC directly instead of going through an intermediate step?
TOPICS
Advanced techniques

Views

333

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 08, 2007 Feb 08, 2007

Copy link to clipboard

Copied

Is it possible to have a form call a CFC directly instead of going
through an intermediate step?

Yup, most people don't seem to like this functionality, but it is allowed.

<form action="aFormComponent.cfc" method="post"...>
...
<input type="hidden" name="method" value="functionNameToUse">
</form>

The function being called by this method must have an access="remote"
property.

As usual, the documentation has all the details.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 08, 2007 Feb 08, 2007

Copy link to clipboard

Copied

Documentation? LOL I looked, didn't find it. Sometimes it is really hard to find anything in the documentation. Just where is this tidbit?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 08, 2007 Feb 08, 2007

Copy link to clipboard

Copied

Oh. There it is. But it says you have to put the method in the url not as a hidden input field. No biggy. Couldn't find anything about using a hidden field so maybe you can show me where that is.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 08, 2007 Feb 08, 2007

Copy link to clipboard

Copied

> Oh. There it is. But it says you have to put the method in the url not as a hidden input field. No biggy. Couldn't find anything about using a hidden field so maybe you can show me where that is.

Just put it int he URL, as per the docs. Nowt wrong with doing that.

--
Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 08, 2007 Feb 08, 2007

Copy link to clipboard

Copied

Oh. There it is. But it says you have to put the method in the url not
as a hidden input field. No biggy. Couldn't find anything about using a
hidden field so maybe you can show me where that is.

I believe it works either way.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 08, 2007 Feb 08, 2007

Copy link to clipboard

Copied

LATEST
http://www.adobe.com/livedocs/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Co...

This link shows a poor example that uses BOTH techniques at the same
time. I would just pick one or the other myself.

<h2>Find People</h2>
<form action="components/corpQuery.cfc ***?method="getEmp"*** method="post">
<p>Enter employee's last Name:</p>
<input type="Text" name="lastName">
***<input type="Hidden" name="method" value="getEmp">***
<input type="Submit" title="Submit Query"><br>
</form>

Note: ***Highlighted Text*** and of course this example will not work
with these delimiting strings included.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation