1 Reply Latest reply on Sep 22, 2006 12:30 AM by interarnett2

    Form field with comma delimited value list to cfc

      I have a form that passes a field to an action page with a comma delimited value.

      For instance the field name is: Program_ID

      value for program_ID is: 31, 32

      I am able to treat this variable as a list and check its length, and loop over the list prior to passing it to a cfc using the attached code:

      When I try and pass the variable as a string to a cfc and invoke a query, cf no longer recognizes my var as a list.

      Therefore the code attached does not function...

      Is there a specific var type that will pass through as a list and allow me to run the code block attached?


        • 1. Re: Form field with comma delimited value list to cfc
          interarnett2 Level 1
          Ok answered my own question.. Here is the answer for those who are interested...

          initialize var for cfc in cfinvoke statement
          <cfinvokeargument name="Program_ID" value="#Form.Program_ID#">

          pass argument to cfc as a string
          <cfargument name="Program_ID" type="string" required="true">

          use listqualify to parse list in cfc and set new var
          <cfset selectedProgramID = ListQualify(Program_ID,"'",",","CHAR")>

          use the new var in the following statement in sql code:
          ((Program_ID) IN (#PreserveSingleQuotes(selectedProgramID)#))

          The following code handles a form field with a single value or a comma delimited value.