New AJAX Feature - <tap:div />

So I just added an item to the framework's default stylesheet for <tap:div /> and also added it to the documentation for the xhtml tag library (which incidentally shows up both under function libraries and custom tags in the docs). You know all the underlying structure was already there, it just wasn't plugged together this way, but now you can use tap:div basically the same way the CFDIV tag works in ColdFusion 8 -- any links inside the div will fetch content via a framework gateway element (AJAX). So here's the code I tested it with.

<cfparam name="attributes.submitted" type="string" default="" />
<cfset attributes.submitted = val(attributes.submitted) />

<cf_html>
<div xmlns:tap="http://www.fusiontap.com" style="margin:20px; text-align:center;">
<tap:div>
<a href="?">
<tap:url name="submitted" value="attributes.submitted+1" />
click me!
</a>
<div>You clicked the link <tap:variable name="attributes.submitted" /> times.</div>
</tap:div>
</div>
</cf_html>

So all the XSL sheet is doing is a real simple copy of the div and its attributes and then adding a tap:gateway inside with a gaterespond event that imports the returned content to the gateway's parent element. So it's the same as if you had written this:

<div>
<tap:gateway>
<tap:event name="gaterespond">
<tap:import target="javascript:element.parentNode" />
</tap:event>

... links go here ...
</tap:gateway>
</div>

I love it when a new feature comes so easily. :)

Comments
BlogCFC was created by Raymond Camden. This blog is running version 5.5.006. | Protected by Akismet | Blog with WordPress