• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 151
  • Last Modified:

Referring to a variable as a String

I have a form that consists of a dynamically-generated set of form fields. Thus, I have fields of unknown nmae coming into my form-processing page.  (they're identified with an ID number).  

How can I get the value of these form fields, if I can't hardcode the names of the fields ahead of time?

e.g. several sets of radio buttons are created, each set having a unique name identifier.  I can know the names of them coming in via hidden form fields generated later, but I can't access the values of the fields, since I can't refer to FORM.#myval# or something like that....
0
IsleOfView
Asked:
IsleOfView
  • 3
1 Solution
 
IsleOfViewAuthor Commented:
Adjusted points from 200 to 300
0
 
IsleOfViewAuthor Commented:
Increased points to 300...

Maybe if I just had the query string, I could get what I needed....how can I get that?  (This is a result of a POST operation)
0
 
paulkdCommented:
Use the Form.FormField field which is passed from all forms....

Insert this code on your action page

<CFIF ISDefined("Form.Fieldnames")>
  <table border="1">
    <CFOUTPUT>
      <CFLOOP Index="FieldName" List="#Form.Fieldnames#">
        <td>Form.#FieldName#</td> <td>#Evaluate(FieldName)#&nbsp;</td></tr>
      </CFLOOP>
    </CFOUTPUT>
  </table>
</CFIF>

Note: that radio buttons and checkboxes will not return a field if they are not selected/checked, so have a default radio button checked.
0
 
IsleOfViewAuthor Commented:
Thanks....that worked great--enjoy the points...I needed a fast answer!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now