StructToHidden(struct)
Last updated March 10, 2002
Version: 1 | Requires: ColdFusion 5 | Library: UtilityLib
Description:
A quick way to turn a simple structure into hidden form fields.
Return Values:
Returns a string.
Example:
st = structNew();
st.foo = "bar";
st.another = "some stuff";
writeOutput(htmlCodeFormat(structToHidden(st)));
</cfscript>
Parameters:
| Name | Description | Required |
|---|---|---|
| struct | The structure to convert. | Yes |
Full UDF Source:
<cfscript>
/**
* Converts a structure to hidden form fields.
*
* @param struct The structure to convert.
* @return Returns a string.
* @author Nathan Dintenfass (nathan@changemedia.com)
* @version 1, March 10, 2002
*/
function structToHidden(struct){
//a variable for iterating
var key = "";
//a variable to return stuff
var outVar = "";
//now loop through the form scope and make hidden fields
for(key in struct){
if(isSimpleValue(struct[key]))
outVar = outVar & "<input type=""hidden"" name=""" & key & """ value=""" & htmlEditFormat(struct[key]) & """>";
}
return outVar;
}
</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)