---Reply to
> 
> Can someone give me a SIMPLE  example of this  custom tag
> (CF_RETURNFUSEACTION)   in action ?

Sure, here are 2 fuses, mainMenu which has 2 file, qry_mainMenu.cfm and
dsp_mainMenu.cfm, and login which has qry_login.cfm and dsp_login.cfm. 
The user wants to use the mainMenu fuse, but that requires they be logged
in first.  So the process is this

1) qry_mainMenu.cfm checks to see if logged in, the user isn't logged in so
it sets a RFA (<CF_RETURNFUSEACTION>) of the mainMenu fuse and passes off
(<CFLOCATION>) to the login fuse to get the user to login. 

2) qry_login.cfm does nothing the first time through because the user has not yet 
filled
out the form. 

3) dsp_login.cfm shows the user a login form, uiser enters correct
username and password and hits submit button

4) qry_login.cfm sees that the user has filled out the form and that the
username and password are correct, logs the user in (<CFSET
SESSION.LoggedIn = 1>) and calls <CF_RETURNFUSEACTION> to get it to go
back to the mainMenu.

5) qry_mainMenu.cfm does nothing this time because the user is logged in
(SESSION.LoggedIn is true)

6) dsp_mainMenu.cfm displays the main menu.

Note that the login fuse didn't know (or care) at all where the user had come from
to get there, or where the user is supposed to go when they have logged
in, all it knows is that it's job is to get the user logged in and then
get <CF_RETURNFUSEACTION> to send them to the correct place afterwards. 
By doing this, you could employ the login fuse anywhere on your site that
needs a login before functioning - just replace mainMenu for whatever fuse
you so desire - the job of the login fuse remains unchanged no matter how
you get there or where you go afterwards - therin lies the beauty of
returnfuseaction.cfm.


the files are as follows.
----------------------
qry_mainMenu.cfm
----------------------
<CFPARAM NAME="SESSION.LoggedIn" DEFAULT="0">
<CFIF NOT SESSION.LoggedIn>
    <!---
        - If the user is NOT logged in
        - set a return fuseaction back to mainMenu and
        - head off to the login page.
      --->
    <CF_RETURNFUSEACTION ACTION="SET" URL="#CGI.SCRIPT_NAME#?FuseAction=mainMenu">
    <!--- The return fuseaction stack is now contains 1 URL --->
    <CFLOCATION URL="#CGI.SCRIPT_NAME#?FuseAction=login">
</CFIF>

----------------------
dsp_mainMenu.cfm
----------------------
This is the main menu...

----------------------
qry_login.cfm
----------------------
<CFIF IsDefined("ATTRIBUTES.Do_Login")>
    <!--- If the user has entered login details, do this --->
    <CFIF (Trim(ATTRIBUTES.Username) eq "user") AND
           (Trim(ATTRIBUTES.Password) eq "pass")>
        <!--- The user supplied correct un/pw so log in, and 
              "return" to the url on the top of the return 
              fuseaction stack (back to the mainMenu fuse in this case
          --->
        <CFSET SESSION.LoggedIn = 1>
        <CF_RETURNFUSEACTION ACTION="RETURN"> <!--- This does a <CFLOCATION 
URL="#CGI.SCRIPT_NAME#?FuseAction=mainMenu"> internally --->
    </CFIF>
</CFIF>

----------------------
dsp_login.cfm
----------------------
Please login<BR>
<CFFORM ACTION="#CGI.SCRIPT_NAME#?FuseAction=#ATTRIBUTES.FuseAction#" 
ENCTYPE="multipart/form-data">
Username : <CFINPUT TYPE="TEXT" NAME="Username"><BR>
Password : <CFINPUT TYPE="PASSWORD" NAME="Password"><BR>
<CFOUTPUT><INPUT TYPE="SUBMIT" NAME="Do_#ATTRIBUTES.FuseAction#" VALUE="Log Me 
In"></CFOUTPUT>
</CFFORM>




---
James Sleeman
[EMAIL PROTECTED] (home)
[EMAIL PROTECTED] (work)


------------------------------------------------------------------------------
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/fusebox or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to