Adobe COLDFUSION 9 Manual page 827

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

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Requesting and Presenting Information
The following example shows how to use the
the Login! button, the doLogin function calls the proxy
method. The
validateCredentials
valid, returns
to the proxy. Because the proxy is synchronous (the default), the
true
value. If the value is
, it hides the login window; the user can then access the page contents. If the return value is
true
, the
function displays a message in the login window title bar.
false
doLogin
The following example shows the setForm.cfm application:
<html>
<head>
<script type="text/javascript">
function doLogin() {
// Create the Ajax proxy instance.
var auth = new AuthenticationSystem();
// setForm() implicitly passes the form fields to the CFC function.
auth.setForm("loginForm");
//Call the CFC validateCredentials function.
if (auth.validateCredentials()) {
ColdFusion.Window.hide("loginWindow");
} else {
var msg = document.getElementById("loginWindow_title");
msg.innerHTML = "Incorrect username/password. Please try again!";
}
}
</script>
</head>
<body>
<cfajaxproxy cfc="AuthenticationSystem" />
<cfif structKeyExists(URL,"logout") and URL.logout>
<cflogout />
</cfif>
<cflogin>
<cfwindow name="loginWindow" center="true" closable="false"
draggable="false" modal="true"
title="Please login to use this system"
initshow="true" width="400" height="200">
<!--- Notice that the form does not have a submit button.
tag to submit the contents of a login form. When the user clicks
SetForm
function and then the
setForm
method checks the password of the user and if it is
validateCredentials
Last updated 8/5/2010
AuthenticationSystem.cfc
method gets the returned
doLogin
822

Advertisement

Table of Contents
loading

Table of Contents