> Is Blackstone going to take care of this non XHTML
> compliant code CF writes for cfform? Everything is
> uppercase.

> I'm trying to make all my stuff XHTML compliant, and I
> like using cfform/validation because I'm extremely lazy!

> Will

You might also have a look at the onTap framework -- which has much
more robust, bulletproof and reuseable (but no more difficult to use)
form validation features.

quick example:

<cfmodule template="#request.tapi.xhtml()#">
  <form xmlns:tap="http://www.fusiontap.com"; tap:dbtable="product">
    <tap:formhighlight />
    <table>
      <tr>
        <td id="labelProductName">Product Name</td>
        <td>
          <input name="productname"
          tap:label="labelProductName" />
        </td>
      </tr>
      <tr>
        <td id="labelProductCategory">Product Category</td>
        <td>
          <select name="categoryid"
          tap:label="labelProductCategory">
            <tap:dbfilter column="active" content="1" />
            <option value="">----</option>
          </select>
        </td>
      </tr>
      <tr>
        <td id="labelProductStatus">Status</td>
        <td>
          <input type="radio"
          name="productstatusid"
          tap:label="labelProductStatus" />
        </td>
      </tr>
      <tap:validate type="required">
        <tr>
          <td id="labelListPrice">List Price</td>
          <td>
            <input name="listprice"
            label="labelListPrice"
            tap:validate="numeric" />
          </td>
        </tr>
        <tr>
          <td id="labelAvailableDate">Available Date</td>
          <td>
            <input name="availabledate"
            tap:label="labelAvailableDate" />
          </td>
        </tr>
      </tap:validate>
    </table>
  </form>
</cfmodule>

This form is actually a little more complicated than is entirely
necessary for the sake of demonstrating features. At the top you see
the attribute tap:dbtable="product" in the form tag which tells the
framework that the forms values being entered will ultimately reside
in this table and the framework uses the meta-data from that table in
your database to automate required, date and numeric field
information. The tap:dbtable attribute could be placed in any element
in your xhtml, not just the form and affects all child-elements.

Within the input elements, the tap:label attribute identifies the
label used in form validators (both server and client-side), so for
example when a user fails to provide a value for the productname
field/column (which will be required if the products.columnname column
in your database is not nullable), both client and server validation
will use the contents of the identified <td> element to display the
name of the input element to the user.

Assuming the listprice column is numeric and the availabledate column
is a date/timestamp column in your database, these columns will both
be automatically validated as numeric and date values respectively in
both client and server validation. The element <tap:validate
type="required"> will make these values required if they aren't
already required due to matching columns in the product table being
not-nullable. The tap:validate="numeric" attribute in the listprice
field will ensure this value is numeric if it's not already numeric as
a result of database integration.

The tap:highlight tag at the top will cause elements which fail to
validate to be colored (default is yellow) to alert the user
immediately to what elements need to be corrected.

Both the category (select) and product status (radio buttons) fields
will have options automatically generated from the database if these
columns are foreign keys in the products table. The tap:dbfilter tag
will limit the list of options to those records in the theoretical
productcategory table where the "active" column has a value of 1.
Unlike cfselect the extra <option> tag in the select element will
appear at the top instead of the bottom of the select list.

You might also notice that none of the input elements in this form
contain any value attributes. By default the form is populated with
matching values in the attributes scope (a combination of form and url
variables). By filling the attributes scope with default values from a
database query it's easy to use the same form for both insert and
update tasks without any modification. (It's also just plain good
separation of presentation from model.) The framework also ensures
that all these values are properly formatted with htmleditformat()
before being displayed in the xhtml returned to the browser.

s. isaac dealey     954.927.5117
new epoch : isn't it time for a change?

add features without fixtures with
the onTap open source framework

http://macromedia.breezecentral.com/p49777853/
http://www.sys-con.com/story/?storyid=44477&DE=1
http://www.sys-con.com/story/?storyid=45569&DE=1
http://www.fusiontap.com


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:192057
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to