Controlling <cfinsert> Form Fields

<cfinsert> instructs ColdFusion to build SQL INSERT statements dynamically. ColdFusion automatically uses all submitted form fields when building this statement.

Sometimes you might want ColdFusion to not include certain fields. For example, you might have hidden fields in your form that aren’t table columns, such as the hidden field shown in Listing 14.7.

That field might be there as part of a security system you have implemented; it isn’t a column in the table. If you try to pass this field to <cfinsert>, ColdFusion passes the hidden Login field as a column to the database. Obviously, this generates an database error, as seen in Figure 14.3, because no Login column exists in the Films table.

Figure 14.3. ...

Get Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.