Solved

Using Coldfusion Fusebox 5 Model

Posted on 2011-09-07
2
565 Views
Last Modified: 2012-05-12
I've created the following alias in the root fusebox.xml.cfm.
<circuit alias="mContact" path="/model/mContact/" parent="" />

Open in new window


The pathing is correct, and the mContact directory exists.  Within it, there are three query files and an action file.  There is also the circuit.xml.cfm, which is shown below.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE circuit>
<!--
	Example circuit.xml file for the model portion of an application.
-->
<circuit access="internal">
	
	<!--
		Example model fuseaction that just references an action fuse.
		Model fuseactions should only reference actions and queries.
	-->
	
	<fuseaction name="buildForm">
		<include template="qry_formBuild" />
	</fuseaction>
	
	<fuseaction name="returnAddresses">
		<include template="qry_addresses" />
	</fuseaction>
	
	<fuseaction name="returnNumbers">
		<include template="qry_numbers" />
	</fuseaction>
	
	<fuseaction name="formSubmit">
		<include template="act_formSubmit" />
	</fuseaction>
	
	<!--
		This is executed at application startup (from <appinit>) and
		therefore is thread safe (and does not need a lock):
	-->
	<fuseaction name="initialize">
		<set name="myFusebox.getApplication().getApplicationData().startTime" value="#now()#" />
	</fuseaction>
	
</circuit>

Open in new window


This is my first time working with Fusebox 5.  How do I call each model fuseaction?  (E.G. Say I want to return the query data from the 'returnAddresses' fuseaction in the mContact model.)  Everything I have tried has equaled 'fail' so far.
0
Comment
Question by:brianmfalls
2 Comments
 
LVL 3

Accepted Solution

by:
devilJinKazama earned 500 total points
ID: 36499611
When you call a fuseaction in the URL, fusebox looks in the controller xml to run the appropriate fuseactions for that call. So lets say you wan to run the 'returnAddress' fuseaction.

firstly you will need to define the fuseaction in the root fusebox xml file :

<circuit alias="mContact" path="/model/mContact/" parent="m" />  --(parent 'm' for model, would be 'v' for view)
<circuit alias="vContact" path="/view/vContact/" parent="v" />
<circuit alias="contact" path="controller/contact" parent="app" />

Now inside your controller folder you would have a folder called 'contact' and inside that your circuit.xml.cfm file.

put this code in that file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE circuit PUBLIC "circuit.dtd" "circuit.dtd">
<circuit access="public">

  <fuseaction name="returnAddresses">
          <do action="mContact.returnAddresses" />
          <do action="vContact.showAddresses" contentvariable="content.body" />
  </fuseaction>

</circuit>

controller : controls your fuseactions, model : gets your data, view : displays data.

so have your view file set up as well. inside view folder you have 'contact' folder and in the circuit.xml.cfm file you will put this code:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE circuit PUBLIC "circuit.dtd" "circuit.dtd">
<circuit access="internal">

      <fuseaction name="showAddresses">
             <include template="dsp_showAddresses" />
       </fuseaction>

</circuit>

inside the dsp_showAddresses file you can dump your qry results. the url u will call to view that page will be

 www.mysite.com/contact/returnAddresses

lemme know if u need more help
0
 
LVL 1

Author Closing Comment

by:brianmfalls
ID: 36536652
Sorry for the delayed response.  Thanks for the help.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now