Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 829

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Requesting and Presenting Information
• The HTTP method (by default,
• Whether to submit the form asynchronously (by default,
The following proof of concept example uses the
to an asyncFormHandler.cfm page, which simply echoes the form values. The callback handler displays an alert with
the returned information.
<html>
<head>
<!--- The cfajaximport tag is required for the submitForm function to work
because the page does not have any Ajax-based tags. --->
<cfajaximport>
<script>
function submitForm() {
ColdFusion.Ajax.submitForm('myform', 'asyncFormHandler.cfm', callback,
errorHandler);
}
function callback(text)
{
alert("Callback: " + text);
}
function errorHandler(code, msg)
{
alert("Error!!! " + code + ": " + msg);
}
</script>
</head>
<body>
<cfform name="myform">
<cfinput name="mytext1"><br />
<cfinput name="mytext2">
</cfform>
<a href="javascript:submitForm()">Submit form</a>
</body>
</html>
The asynchFormHandler.cfm page consists of a single line, as follows:
<cfoutput>Echo: #form.mytext1# #form.mytext2#</cfoutput>
Using the ColdFusion.navigate function to submit a form
The
ColdFusion.navigate
a specified container control, such as a
control other than the one that contains the form when the user submits the data. You can also use the function to
submit the form asynchronously when a user performs an action outside the form, such as clicking a menu item.
For an example that uses this function, see the ColdFusion.navigate function in the CFML Reference.
)
POST
ColdFusion.Ajax.submitForm
JavaScript function can submit a form to a URL and have the returned output appear in
,
,
cfdiv
cflayout
Last updated 1/20/2012
)
true
function to submit two form fields
, or
tag. This function lets you populate a
cfpod
cfwindow
824

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents