deleteFormFields(fieldList)
Last updated June 12, 2003
Version: 1 | Requires: ColdFusion 5 | Library: UtilityLib
Description:
Useful if you need to clean up a form for whatever reason before using the cfinsert or cfupdate tag. Takes a comma-delimited list of form field names as its only argument.
Return Values:
Returns nothing.
Example:
<cfset form.field2 = "goo">
<cfset form.field3 = "zoo">
<cfset form.fieldnames="field1,field2,field3">
<cfdump var="#form#">
<cfset theFields = "field1,field2">
<cfset deleteFormFields(theFields)>
<cfdump var="#form#">
Parameters:
| Name | Description | Required |
|---|---|---|
| fieldList | List of fields to return. | Yes |
Full UDF Source:
<cfscript>
/**
* Removes specified fields from a form structure.
*
* @param fieldList List of fields to return. (Required)
* @return Returns nothing.
* @author Tom Young (tom@thenewmediagroup.com)
* @version 1, June 12, 2003
*/
function deleteFormFields(fieldList) {
var listIndex = 1;
var i = 1;
fieldList = ListToArray(fieldList);
for(i = 1; i lte ArrayLen(fieldList); i = i + 1) {
StructDelete(form, fieldList[i]);
listIndex = ListFindNoCase(form.fieldnames, fieldList[i]);
form.fieldnames = ListDeleteAt(form.fieldnames, listIndex);
}
}
</cfscript>
Search CFLib.org
Latest Additions
Dave Anderson added
iniToStruct
20 day(s) ago
Dave Anderson added
deDupeArray
20 day(s) ago
Richard added
dice
22 day(s) ago
Isaac Dealey added
getRelative
a while ago
Top Rated
backupDatabase
Rated 5.0, 22 time(s)
indentXml
Rated 5.0, 10 time(s)
generateSsccAsn
Rated 5.0, 4 time(s)
highlightAndCrop
Rated 5.0, 4 time(s)