Combining HTML and CFML Form Controls

The cfform tag enables you to create dynamic forms using controls that include such HTML controls as input boxes, drop-down boxes, and radio buttons, as well as a number of specialized Java applet-based controls, such as trees, grids, and sliders. Forms created using the cfform tag are coded in the same manner as regular HTML forms. In fact, the cfform tag allows you to mix standard HTML and CFML form controls in the same form.

The following example creates a form using cfform and places a standard HTML submit button on the page:

<cfform action="MyFormProcessor.cfm" name="MyForm" 
        enctype="application/x-www-form-urlencoded">
   
  <input type="submit" name="submit" value="submit">
   
</cfform>

The cfform tag has many of the same attributes as the HTML form tag. The action attribute is required and specifies where the form should be submitted upon completion. name is optional and specifies a name for the form. You should specify a value for name if you plan to reference the form later in your application. In previous versions of ColdFusion, the cfform tag used an attribute called enablecab to make Java-based form controls available to Microsoft Internet Explorer users as Microsoft cabinet files. In Version 5.0, the enablecab attribute was deprecated and made nonfunctional. In its place, two new optional attributes have been added to the cfform tag to enhance performance of the Java-based cfform controls:

codebase=" url "

Specifies the URL to a downloadable ...

Get Programming ColdFusion MX, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.