CFLib.org – Common Function Library Project

URLToHidden([excludeList])

Last updated March 10, 2002

Version: 1 | Requires: ColdFusion 5 | Library: UtilityLib

 
Rated 1 time(s). Average Rating: 4.0

Description:
This is a quick way to capture the URL variables on a given page as hidden fields in a form. This is useful when you have a multi-step process.

Return Values:
Returns a string.

Example:

view plain print about
<cfoutput>
    #htmlCodeFormat(urlToHidden())#
</cfoutput>

Parameters:

Name Description Required
excludeList A list of keys not to copy from the URL structure. No

Full UDF Source:

view plain print about
<cfscript>
/**
 * Converts the URL structure to hidden form fields.
 * 
 * @param excludeList      A list of keys not to copy from the URL structure. 
 * @return Returns a string. 
 * @author Nathan Dintenfass (nathan@changemedia.com) 
 * @version 1, March 10, 2002 
 */

function urlToHidden(){
    //a variable for iterating
    var key = "";
    //should we exlude any?  by default, no
    var excludeList = "";
    //a variable to return stuff
    var outVar = "";
    //if there is an argument, it is a list to exclude
    if(arrayLen(arguments))
        excludeList = arguments[1];
    //now loop through the form scope and make hidden fields
    for(key in url){
        if(NOT listFindNoCase(excludeList,key))
            outVar = outVar & "<input type=""hidden"" name=""" & key & """ value=""" & htmlEditFormat(url[key]) & """>";
    }
    return outVar;        
}
</cfscript>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Dave Anderson Dave Anderson added
iniToStruct
20 day(s) ago

Dave Anderson Dave Anderson added
deDupeArray
20 day(s) ago

Richard Richard added
dice
22 day(s) ago

Isaac Dealey Isaac Dealey added
getRelative
a while ago

Top Rated

Darwan Leonardo Sitepu backupDatabase
Rated 5.0, 22 time(s)

Barney Boisvert indentXml
Rated 5.0, 10 time(s)

Kevin Pepperman generateSsccAsn
Rated 5.0, 4 time(s)

Raymond Camden highlightAndCrop
Rated 5.0, 4 time(s)

Created by Raymond Camden / Design by Justin Johnson