0
votes
  1. How can I make a list of form fields test1 = "firstname,lastname,mode, etc" My goal is to move the code to a object so I can just pass it in.

    <cfinvoke component="#request.componentdir#.tars.tars" method="init" returnvariable="oTars">
    
    <cfscript>
        test1 = 'mode';
        if(isDefined("session.formFields.#test1#") and session.formFields.#test1# neq ''){
            oTars.set#test1#(session.formFields.#test1#);
        }
    
        test2 = 'mode';
    
        if(isDefined("session.formFields.#test2#") and evaluate("session.formFields.#test2#") neq ''){
            evaluate(oTars.set#test1#(session.formFields.#test2#));
        }
    </cfscript>
    <cfdump var="#oTars#">
    
1
The question is not entirely clear, but if you are using cfinvoke to run the init method of a cfc, you might be on the wrong path altogether. - Dan Bracuk
Which version of ColdFusion? - Adam Cameron

1 Answers

0
votes

ColdFusion gives you a list of all the field names, that are a part of the post request, within the form scope. The key name is "FieldNames".

So

<cfset test1 = Form.FieldNames>