Controlling CFDIV content with a CFINPUT date control

Coldfusion 8Using the new bind functions of CF8 are really nice to use. My websites are easier on the eyes, and more fun to navigate through the use of AJAX functionality.

Another example of how to use this fun stuff:






<table border="0" width="465" cellpadding="3" cellspacing="0">
<cfform>
<tr><td class="pad-content">
Startdate:<cfinput type="datefield" name="startdate" value="#lsdateformat(now()-14, 'd/m/yyyy')#" mask="d/m/yyyy">
</td><td>
Enddate:<cfinput type="datefield" name="enddate" value="#lsdateformat(now(), 'd/m/yyyy')#" mask="d/m/yyyy">
</td>
</tr>
</cfform>
</table><br />


<cfdiv bind="url:page_entrylist_div.cfm?sd={startdate}&ed={enddate}" style="padding-left: 20px;">
I've got 2 date input controls here (put next to each other, since they overlap when opening them otherwise), and they tie to the CFDIV at the end of my code.

Inside this CFDIV this content is loaded:

<cfif isDate(url.sd) and isDate(url.ed)>
   <cfset startdate = lsparsedatetime(url.sd & " 00:00")>
   <cfset enddate = lsparsedatetime(url.ed & " 23:59")>

   <cfif datecompare(startdate, enddate) EQ -1>

      <cfinvoke component="...">
And I draw a table which shows data for this specific period. It's really simple and really fast to create.

Comments

BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.