22.08.2013 Views

ColdFusion Developer's Guide

ColdFusion Developer's Guide

ColdFusion Developer's Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta<br />

<br />

<br />

<br />

<br />

<br />

The showName.cfm action page has the following code:<br />

<br />

The Name is : #Form.name#<br />

<br />

In this example, when you enter a name in the text input and click the Enter name button,<br />

the entered text replaces the form on the page, but the rest of the page is not refreshed.<br />

Using the cfajaxproxy SetForm function<br />

The SetForm function of the proxy object created by the cfajaxproxy tag passes the form<br />

values as arguments to the next CFC function proxy that you call after the SetForm function.<br />

This way, you can pass the current values of fields in a form to a CFC, which can then do the<br />

necessary processing and return a result.<br />

When you use the SetForm function, the following rules apply to the arguments in the called<br />

CFC function:<br />

■ The function does not need to specify the form fields in cfargument tags, and the<br />

function still gets the field values passed by name.<br />

■ Form fields which have the same names as CFC arguments will override any values passed<br />

to the CFC argument from the proxy function call.<br />

■ If you do not specify form fields in the in cfargument tags, They do not necessarily<br />

immediately follow any declared arguments when you use positional (array) notation to<br />

access them in the arguments structure.<br />

■ The arguments scope in the CFC function includes two fields that <strong>ColdFusion</strong> uses to<br />

control its behavior. These fields are intended for internal use, and their names might<br />

change in future releases. Both field values are set to true:<br />

■ _CF_NODEBUG tells <strong>ColdFusion</strong> not to return debugging output in the call response.<br />

■ _CF_NOCACHE tells <strong>ColdFusion</strong> send a no cache header on the response, which<br />

prevents the browser from caching the response and ensures that every AJAX request<br />

results in a network call.<br />

Using AJAX form controls and features 901

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!