Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Using Coldfusion Fusebox 5 Model

Posted on 2011-09-07
2
Medium Priority
?
602 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 2000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
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…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

824 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