Uploading Files with cf_sebForm
In my ongoing series about using cf_sebForm, I have so far left out one important feature - the ability to upload files. This is essential functionality whether you are saving a record or sending email.
In my ongoing series about using cf_sebForm, I have so far left out one important feature - the ability to upload files. This is essential functionality whether you are saving a record or sending email.
I saw two blog entries recently (by Ben Nadel and by Mark Mazelin) on generic solutions to automatically send email with a form. This is a common need for a lot of web sites, especially on contact forms. These entries motivated me to show how cf_sebForm handles this.
When I was working on cf_sebForm, I knew that I wanted it to work on any site. That meant that I had to be able to use the same code for different output on different sites. At first all of my forms were tabular, with code like the following:
Although I briefly touched on validation in cf_sebForm, it is certainly a topic that deserves more attention. This is especially true in light of Ben Nadel's great entry on data type validation versus data value validation (and his final thoughts on the same topic). It is an important distinction and I want to cover how cf_sebForm deals with the challenge.
While working on my custom tag set, I discovered that I often have attributes that will be the same across a whole site. These attributes need to change from site to site.
For example, I have a "skin" attribute to skin the output of my custom tags. Every tag in a site should use the same skin. If I copy some code from one site to another, it should automatically use the skin of the site to which it is copied.
I frequently have to build forms to add and edit data. After a few years of programming, this became a source of come tedium for me. I would build two forms almost exactly alike (one to add and one to edit). If the form needed to change, I would have to make the change twice. I would also have to write any validation twice for each form - once for the friendly client-side JavaScript validation and again for the serious server-side validation.
All told, this represented a fair bit of tedium in my work life. I decided that there had to be a better way. I looked at solutions that existed already in the ColdFusion universe, but I couldn't find anything that I liked. Then I came across some custom tags for forms that I client of mine built. Although his implementation didn't work as I wanted, I knew that he was on the right path.
Before I can effectively cover anything else in cf_sebForm, I have to cover how to get data to the fields. Fortunately, this by itself will make cf_sebForm somewhat useful.
The cf_sebForm tag set creates accessible forms that provide both client and server side validation. They can interact with CFCs without breaking encapsulation. The forms are skinnable and completely customizable. It also facilitates using the same code as both an add and an edit form.
I have been using my sebtags custom tag set (or parts thereof) for the last three or four years and they are now finally ready for beta.