ColdFusion One Liners Presentation at CFinNC Slides Posted
ColdFusion 8, ColdFusion 9, CFinNCThe slides and code from my ColdFusion One Liners presentation at CFinNC are now up on SlideSix.
View the presentation on SlideSix
I enjoyed giving the presentation and if you have any questions let me know.
Use cfajaximport to help with CF8 to CF9 migration
ColdFusion 8, ColdFusion 9This came up in Raymond Camden's CFUnited presentation this morning and he suggested I blog it so here it is.
Problem:
You have extended the cfajax tags by calling the extJS functionality directly. CF8 uses extJS 1.1 whereas CF9 is going to use extJS 3.0. There will be cases it appears where this will break your code as some features have changed from the 1.1 to 3.0 release.
Solution:
- Copy the needed JavaScript files (from /cfide/scripts/ajax/*) to another folder in the webroot (say /cfExtJS11/ajax/) and make sure you keep the folder structure.
- On the top of any pages where you the cfajax tags use the cfajaximport tag:
<cfajaximport scriptSrc="/cfExtJS11">
(Edit 10/14: I made a minor change to item 1 for clarification)
Submitting a cfform inside a cfdiv to a new page
ColdFusion 8A form created with cfform inside a cfdiv will submit via AJAX and have the response placed in the div created by the cfdiv.
Its possible, with a little JavaScript and HTML, to have the form submit to a new page and to use the cfform validation if needed. First lets look at the main page:
<cfajaximport tags="cfform"> <h2>My Page</h2> <cfdiv bind="url:theForm.cfm">
Not doing much here other than setting up a very basic page with a cfdiv that will get the source from theForm.cfm. Lets now look at that page:
<cfform method="post" action="theDestination.cfm" id="divForm" name="divForm">
Team: <cfinput type="date" name="team" id="team" required="true" message="Please enter your team">
<br>
<cfinput type="submit" name="sub" id="sub" value="Submit Via AJAX"><br>
<input type="button"
onclick="if (_CF_checkdivForm(this.form)) {document.divForm.submit();}"
value="Submit the to a New Page">
</cfform>A standard cfform example that uses some validation (I researched this topic because the form I was using had extensive use of the datefield type of cfinput). Clicking on the Submit button will submit the form via AJAX and display the results (I've listed theDestination.cfm below).
Clicking on 'Submit to a New Page' button (and its a standard html button) will, if the form passes validation, submit to a new page. If it fails validation and the user had not entered a team that message via an alert will be displayed. Lets take a look at the JavaScript inside the onClick:
if (_CF_checkdivForm(this.form)) {document.divForm.submit();}
The function inside the if statement is written by ColdFusion and is there for all cfform produced forms. The name of this function is simply _CF_check and the value placed in the id attribute for cfform. That function will return true or false and if true we tell the browser to submit the form.
For reference here is the coe for theDestination.cfm:
<cfdump var="#form#">
Should Ben Forta Twitter? What the Stats Say Plus my Quick Review of Twitter
ColdFusion 8[UPDATE] Ben Forta now has a Twitter account [/UPDATE]
The other day Ben Forta posted an entry about Twitter and mentioned that he was not a user as he "didn't get the whole Twitter thing". Fair enough.
I found this interesting because Twitter is essentially "micro-blogging" and Ben's blog is a mixture of short "micro-blogging" posts generally annoucing news and longer posts that often go in to great detail. So I decided to find out how many of Ben's entries would qualify for the 140 character twitter maximum. This proved to be rather easy:
<cffeed action="read" query="getBen" source="http://feeds2.feedburner.com/BenForta"> <cfset twitterOk = 0> <cfloop query="getBen"> <cfset body = ReReplaceNoCase( getBen.content, "<(.|\n)*?>", "", "all" )> <cfif len(body) lte 140> <cfset twitterOk++> </cfif> </cfloop> <cfoutput><h2>#twitterOk# of #getBen.recordCount#</h2></cfoutput>
3 of Ben's last 15 entries, stripped of html, would have been ok for Twitter. Maybe its time for Twitter, Ben?
My Thoughts on Twitter
I joined Twitter last summer and have found it to be at times fun, a useful way to find interesteing articles and a good way to do some online networking. I generally follow other technology people and overall have a positive experience of it. Check out my Twitter profile.
Kill That Thread!
ColdFusion 8Every six months or so we have a thread that will not quit and consumes a lot of resources causing general slowness all round.
Its possible to kill the thread with the following code. Put in your ColdFusion Administrator and the thread name which can be found from Server Monitor.
adminObj = createObject("component","cfide.adminapi.administrator");
adminObj.login([password]);
sMonObj = createObject("component","cfide.adminapi.servermonitoring");
sMonObj.abortRequest("jrpp-100");CFUnited Presentations Posted: Intro to CFML plus Creating, Manipulating and Printing PDFs
ColdFusion 8, CFUnitedHere are the presentations and code from my two CFUnited talks. I enjoyed giving the sessions and if you have any questions please let me know.
Creating, Manipulating and Printing PDFs
Intro to CFML as a language






Loading....