Adobe COLDFUSION 9 Manual page 828

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Requesting and Presenting Information
Submit action is performed by the doLogin function. --->
<cfform name="loginForm" format="xml">
<cfinput type="text" name="username" label="username" /><br />
<cfinput type="password" name="password" label="password" />
<cfinput type="button" name="login" value="Login!" onclick="doLogin();" />
</cfform>
</cfwindow>
</cflogin>
<p>
This page is secured by login.
You can see the window containing the login form.
The window is modal; so the page cannot be accessed until you log in.
<ul>
<li><a href="setForm.cfm">Continue using the application</a>!</li>
<li><a href="setForm.cfm?logout=true">Logout</a>!</li>
</ul>
</p>
</body>
</html>
The following example shows the AuthenticationSystem.cfc file:
<cfcomponent output="false">
<cffunction name="validateCredentials" access="remote" returntype="boolean"
output="false">
<cfargument name="username" type="string"/>
<cfargument name="password" type="string"/>
<cfset var validated = false/>
<!--- Ensure that attempts to authenticate start with new credentials. --->
<cflogout/>
<cflogin>
<cfif arguments.username is "user" and arguments.password is "secret">
<cfloginuser name="#arguments.username#"
<cfset validated = true/>
</cfif>
</cflogin>
<cfreturn validated/>
</cffunction>
</cfcomponent>
Using the ColdFusion.Ajax.submitForm function
You can use the
ColdFusion.Ajax.submitForm
page) at any time. For example, you could use this function to automatically save a partially completed form. This
function does not support uploading a file attachment to the form.
When you use this function, you pass it the name of the form to submit and the URL of the page that processes the
form. You can also specify the following optional parameters:
• A callback function that handles the returned results
• An error handler that takes two parameters, an HTTP error code and a message
password="#arguments.password#" roles="admin"/>
function to submit form contents to a CFML page (or other active
Last updated 8/5/2010
823

Advertisement

Table of Contents
loading

Table of Contents