jamiejackson

Untitled

May 14th, 2012
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!---
  2.  
  3. This file is part of muraFW1
  4. (c) Stephen J. Withington, Jr. | www.stephenwithington.com
  5.  
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10.  
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License along
  17. with this program; if not, write to the Free Software Foundation, Inc.,
  18. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  19.  
  20.         Document:   /public/controllers/main.cfc
  21.         Author:     Steve Withington | www.stephenwithington.com
  22.  
  23. --->
  24. <cfcomponent extends="controller" output="false">
  25.  
  26.     <!--- ********************************* PAGES ******************************************* --->
  27.  
  28.     <cffunction name="default" output="false" returntype="any">
  29.         <cfargument name="rc" required="true" />
  30.         <cfdump var="#rc#" label="am i here?"><cfabort>
  31.        
  32.     </cffunction>
  33.  
  34.     <cffunction name="handleForm" output="false" returntype="any">
  35.         <cfargument name="rc" required="true" />
  36.        
  37.         <cfdump var="#rc#" label="in handleForm" expand="false">
  38.         <cfif structKeyExists(arguments.rc, "formId") >
  39.             <cfinvoke
  40.                 method = "handleForm_#arguments.rc.formId#"
  41.                 rc = "#rc#"
  42.             />
  43.         </cfif>
  44.        
  45.     </cffunction>  
  46.    
  47.     <cffunction name="handleForm_fake_1" output="false" returntype="any">
  48.         <cfargument name="rc" required="true" />
  49.        
  50.         <cfdump var="#rc#" label="in fake_1" expand="false">
  51.         <cfscript>
  52.         variables.fw.service( "name.saveFirstName", "data" );
  53.         </cfscript>
  54.         <cfdump var="#rc#" label="rc" expand="false" abort="true" />
  55.         <cfscript>
  56.        
  57.         if ( not data.success ) {
  58.             arguments.rc.errors = data.errors;
  59.             fw.redirect(action="public:example.form1", preserve="all");
  60.         } else {
  61.             fw.redirect(action="public:example.form2", preserve="all");
  62.         }
  63.        
  64.         </cfscript>
  65.     </cffunction>
  66.    
  67.     <cffunction name="handleForm_fake_2" output="false" returntype="any">
  68.         <cfargument name="rc" required="true" />
  69.        
  70.         <cfscript>
  71.         if (len(trim(rc.lastname)) is 0) {
  72.             arguments.rc.errors = {};
  73.             arguments.rc.errors.lastName = "Required.";
  74.             fw.redirect(action="public:example.form2", preserve="all");
  75.         } else {
  76.             fw.redirect(action="public:example.thanks", preserve="all");
  77.         }
  78.         </cfscript>
  79.     </cffunction>
  80.  
  81. </cfcomponent>
Advertisement
Add Comment
Please, Sign In to add comment