Jered, the following is a working example from one of our
application.cfm pages that submits to itself.  If the form.username is
not defined, it sets showUNameHelp to yes, then in the html part of the
template it points to an invalid username error.  Same thing for
invalid password error.  If you have any questoins after digging
through this, let me know.


<cfif not IsAuthenticated()> <!--- User is not authenticated --->
  <cfset showLogin = "No">
  <cfset showHelp = "No">
  <cfif IsDefined("form.username") and IsDefined("form.password")> 
      <!--- The Login Form was submitted --->
    <CFPARAM NAME="Client.username" DEFAULT="#form.username#">
      <cftry>
        <!--- Try to authenticate the user --->
        <cfif form.login is ''>
          <cfset showUNameHelp = "Yes">
        <cfelse form.password is ''>
          <cfset showPassHelp ="Yes">
        </cfif>
        <cfauthenticate setcookie="Yes"
         throwonfailure="Yes"
         securitycontext="blah"
         username="#form.username#"
         password="#form.password#">
        <cfcatch type="Security">
        <cfset showLogin = "Yes">
        <cfset showHelp = "Yes">
      </cfcatch>
    </cftry>
    <cfelse> <!--- The Login Form was not submitted --->
      <cfset showLoginHelp = "Yes">
    </cfif>
        
<cfif showLogin>
  <cfset url = "#cgi.script_name#">  
     <!--- Store the page they are on to return to it after
authentication --->
  <cfif cgi.query_string is not "">
  <cfset url = url & "?#cgi.query_string#">
</cfif>
<cfoutput>
  <html>
  <head>
  </head>
  <body>
  <cfif showUNameHelp>
    <font>Invalid Username</font><br><br>
  <cfelseif showPassHelp>
   <font>Invalid Password</font><br><br>
  </cfif>
                        
<form action="#url#" Method="post">
  <table>
  <tr>
    <td class="name">Username:</td>
    <td><input type="Text" name="username"></td>
  </tr>
  <tr>
    <td class="name">Password:</td>
    <td><input type="Password" name="password"></td>
  </tr>
  <tr>
    <td colspan="2" align="center"><br><input type="submit"
value="Login"><br><br><br></td>
  </tr>
</form>
</table>
</cfoutput>
<cfabort>
</body>
</html>
</cfif>
</cfif>



--- [EMAIL PROTECTED] wrote:
> From: [EMAIL PROTECTED]
> Date: Tue, 24 Apr 2001 12:40:33 -0500
> To: [EMAIL PROTECTED]
> Subject: [KCFusion] displaying a message to the user
> Reply-to: [EMAIL PROTECTED]
> 
> Hi all.  Here's my latest trial.  I feel like I am so close, but I
> just can't quite figure it out.  I have a login prompt.  When the use
> does not log in properly, the action page directs the browser back to
> the login prompt.  I want to display a message to the user based on
> what they did wrong.  For example, if the user left the password
> field blank, I want the message to say, "No password supplied".  I
> expect that I would want to populate a variable within CFIF statement
> that evaluates what the user did incorrect and reference that value
> on the calling page so that when it is reloaded, if it is defined,
> the message is displayed.  I just can't seem to figure out what type
> of variable can be populated by an action page and returned to a
> calling page.  Do I have to use session variables?  Thank you so
> much.
>  Jered
> 
> 
>
______________________________________________________________________
> The KCFusion.org list and website is hosted by Humankind Systems,
> Inc.
> List Archives........
> http://www.mail-archive.com/cf-list@kcfusion.org
> Questions, Comments or Glowing Praise..
> mailto:[EMAIL PROTECTED]
> To Subscribe....................
> mailto:[EMAIL PROTECTED]
> To Unsubscribe................
> mailto:[EMAIL PROTECTED]
>  


=====
Rooms with angular corners will only encourage you to be cornered in life.  Lessen the 
danger by stapling pickled beets or meringue to the apex of the corner.
-from the Little Book of Wrong Shui

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/
 
 
______________________________________________________________________
The KCFusion.org list and website is hosted by Humankind Systems, Inc.
List Archives........ http://www.mail-archive.com/cf-list@kcfusion.org
Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED]
To Subscribe.................... mailto:[EMAIL PROTECTED]
To Unsubscribe................ mailto:[EMAIL PROTECTED]
 

Reply via email to