Why not just call events in Mach-ii from your Ajax calls?
JS code (using prototype.js):
function getStreets:()
{
var url = ["index.cfm?"
, "event=getAddresses"
, "postcode=" + postcode
, "suburb=" + suburb
, "state=" + state
, "item=street"
].join("&");
var options = { method: "get"
, onCreate: function()
{
//do some stuff
}.bind(this)
, onComplete: function(request)
{
// do some stuff with the result
}.bind(this)
};
new Ajax.Request(url, options);
}
Mach-ii.xml
<event-handler event="getAddresses" access="public">
<filter name="securityFilter" />
<notify listener="AddressController" method="getAddresses"
resultkey="request.output" />
<view-page name="ui.getAddresses" contentkey="request.output" />
<view-page name="stringOutput" />
</event-handler>
Call the controller, get your data and then in this example ui.getAddresses
takes the query returned by the controller into a select box (but it could
anything: XML/JSON) and stringOutput actually returns the content back to the
browser.
Hope this helps.
Cheers
Greg
On 05/10/2010, at 2:04 PM, Sawyer, Edward wrote:
> RE: Form Selection Data Dependencies
>
> When I did this not long ago (they are called “Chained selects”), I used
> jQuery and ajax.cfc, and did it completely outside of Mach-II, I had the ajax
> fire off little cfc’s to get the data I wanted, and return it at as a query,
> where I then manipulated it on the view page, as I recall. I was doing a
> 4-level chained select that started with on/off campus, then if on-campus:
> campus, building, room (or state, city, address, if off-campus).
>
> I used jQuery to build and run the chained selects, and ajax.cfc to
> dynamically reload them if a new address was added, so I didn’t have to
> reload the main form to update the chained selects.
>
> It worked fine, not as elegant as fully integrated into Mach-II but it was
> faster and simpler for me. I was using the 1.6 version of Mach-II. I can post
> more details if need be.
>
> Likely there’s a better, more “Mach-II way” of doing things, and I’d be
> interested in hearing about it too , if that’s the case.
>
> -Ed
>
>
> --
> You received this message because you are subscribed to Mach-II for CFML list.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/mach-ii-for-coldfusion?hl=en
>
> ***New URLs as of April 29th, 2010***
> SVN: http://svn.mach-ii.com/machii/
> Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/
--
You received this message because you are subscribed to Mach-II for CFML list.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/mach-ii-for-coldfusion?hl=en
***New URLs as of April 29th, 2010***
SVN: http://svn.mach-ii.com/machii/
Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/