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 09 Venue Mini Review and Vote for My Sessions
CFUnitedEarlier this year I wrote a detailed venue review for CFUnited 2008 helped by the fact I live two blocks from the Washington convention center. CFUnited 09 will take place at the Lansdowne Resort which is a little over 30 miles from my house, and I've been there only once so I can't give as detailed a review.
I can tell you a few things about it though; its a very nice resort, its isolated so the networking will be great, and the room rate prices are great value (and use a CF powered registration system). Also, if you fly into Dulles its very easy to get to. If you liked the North Bethesda location (home of CFUnited 05-07) then you should like the Landsdowne Resort since its a bigger and slightly fancier version.
I submitted two topics for CFUnited 09:
From Eight to Centaur: New Programming Tips and Techniques
Centaur promises new ways to code ColdFusion applications that represent the biggest changes to the core language since CFMX 6.1. Ideas floated at the CFUNITED 08 Keynote included creating UDFs and CFCs with cfscript, a New keyword, cffinally and cfcontinue, implicit getters and setters. This session will walk through specific examples of new ways of coding and discuss the pros and cons.
If a scheduled task fails in the woods, does it make a noise?
Scheduled Tasks and Event Gateways can provide a vital cog of applications but what happens when they fail? This session will look at the monitoring system in place at Interfolio to keep our systems running smoothly. Previously we used a collection of log file checking and sending emails. The new system wraps tasks around a monitoring register, has a front end dashboard that shows the current status of each task and will has mechanisms to control the frequency of how many text messages or emails to send when problems occur.
Vote for them to be included:
http://cfunited.com/go/survey/166
Come Work With Me!
InterfolioIf you are looking for a new job or know someone who is then here is your chance to come work with me at Interfolio. Here is the full job description:
Junior to Mid Level Web Developer
Interfolio is a fast growing company looking for a passionate web developer with strong quality assurance skills. Interfolio helps people collect, deliver & showcase their life's work. Our services are built on powerful, elegant software that enables individuals to pursue their academic and professional goals.
We are looking for a developer who is smart and gets things done. We have a great development team who have won awards and spoken at conferences. This is a position with a lot of growth potential and the environment to help you succeed. Our applications are object-oriented and use industry standard frameworks. The software we build plays a vital role in the lives of tens of thousands of users, impacting crucial life decisions. You would be working on an application that uses code generation and talks to other systems via API's.
Interfolio will celebrate its tenth anniversary next year and is growing at a fast pace. Our main office is in downtown DC and we have a very casual work environment -- most of us wear jeans (and shorts in the summer). We are a mixed office in that we use both Macs and Windows machines based on individuals preference. Our applications are built with Adobe ColdFusion 8 with a MySQL database.
Requirements:
- 2 years experience with one of ColdFusion (preferred), php, perl, ruby, .NET or Java
- Understanding of Object-Oriented (OO) development
- Good knowledge of SQL with MySQL (preferred), SQLServer or ORACLE
- Great command of verbal and written English
- Permanent legal right to work in the United States
- May require some after business hours work (for deployments, etc)
Benefits:
- Work in downtown Washington, DC. Our office scores a 100 on walkscore.com
- Competitive salary
- Generous health insurance plan
- 401(k) retirement plan
- Work on your choice of OS: Mac or Windows
- Training and Conference budget
- Paid time off
To apply please send a resume and cover letter to sam@interfolio.com with a subject line of "Developer"
Dualing Monitors
Editor, AppleI have been using dual monitors for coming on eighteen months and love it.
One problem with dual monitors when using OS X is the quality of the second monitor has to be very high for real Mac feel. My primary monitor is the built in iMac monitor, and my original second monitor, which displays Windows just fine, looked like viewing a the Mac OS through a dirty window despite all my efforts to adjust settings and calibrations. With the Apple Cinema Displays ridiculously over priced this was one of those small annoyances.
Recently I upgraded my second monitor to a Dell SP2009W (yeah, I've no idea how they picked such a cool name either). This monitor is awesome. Within about 10 minutes of messing with the settings, including one that put it in Mac mode, and calibrations I have two monitors that show off the beauty of the Mac OS to an equal degree. I can now truly swap back and forth applications that I would n
I also got a 3M adjustable monitor arm that, apart from making the monitor look like it is suspended, can flip the monitor between portrait and landscape modes. And anything in between if you wish to code on angles. I was excited to try coding in portrait mode as it seemed like it would show more code. This is great for browsing a folder structure and working on one file but when a 20" widescreen monitor is turned to portrait it becomes very narrow. The IDE features become very far apart from each other so for now I have gone back to landscape mode. Below are two photos with this setup.

Portrait view...look at all that code!

More "traditional" landscape.







Loading....