Has anyone ever tried taking the cfswitch
statement and putting it in a seperate file,
so that we can change the fuseaction without
using <cflocation>? (The point is that by
redirecting we lose state, and waste time 
with an additional request.)


INDEX.CFM
---------
.... standard fusebox stuff ...
<cftry>
  <!--- 
    If something goes wrong in a fuse, 
    attributes.fuseaction will be changed
    and an exception will be thrown.
  --->
  <cfinclude template="fuseactions.cfm">         
  <cfcatch type="any">
    <cfinclude template="fuseactions.cfm">
  </cfcatch>
</cftry>


FUSEACTIONS.CFM
---------------
<cfswitch expression="#attributes.fuseaction#">
  <cfcase value="addform">
    <cfinclude template="dsp_form.cfm">
  </cfcase>
  <cfcase value="editform">
    <cfinclude template="qry_data.cfm">
    <cfinclude template="dsp_form.cfm">
  </cfcase>
  <cfcase value="insert">
    <cfinclude template="act_insert.cfm">
    <cfinclude template="dsp_view.cfm">
  </cfcase>
  <cfcase value="update">
    <cfinclude template="act_update.cfm">
    <cfinclude template="dsp_view.cfm">
  </cfcase>
  <cfdefaultcase>
    <cfset attributes.fuseaction="addform">     
  </cfdefaultcase>
</cfswitch>

Patrick

----------------------------------
Patrick McElhaney
Application Developer
American City Business Journals
704-973-1019    704-236-8351 (cell) 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to