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

Dynamic form. name

I want to create a dynamic Serial Number entry screen.  The number of input boxes will be determined by the number of SN that need to be entered.  The problem is accessing the sn's in the action screen. How can I access the sn in the action screen.


FORM SCREEN

<CFLOOP INDEX="SN_Item" FROM="1" TO="#variables.sn_qty#" STEP="1">
<TABLE>
<TR>
      <TD>Serial Number Item: #SN_Item#</TD>
      <TD><INPUT TYPE="text"
       NAME="SN#SN_ITEM#"
       SIZE="10"
       MAXLENGTH="10"></TD>
</TR>
</TABLE>
</CFLOOP>

I can validate the form variables but I can't reach the data.

ACTION SCREEN

<CFIF NOT IsDefined("Form.SN_Qty")>
  SN QTY: You reached this page in error.
  <cfabort>
</CFIF>

<!--- validate Form.SN --->
<CFLOOP INDEX="SN_Item" FROM="1" TO="#Form.SN_Qty#" STEP="1">
  <CFIF NOT IsDefined("Form.SN#SN_ITEM#")>
    <br>SN:#SN_ITEM#: You have reached this page in error.
    <cfabort>
  <CFELSE>
          READ/GET DATA HERE!!!
  </CFIF>
</CFLOOP>


Chris

0
ChirsJB
Asked:
ChirsJB
1 Solution
 
moquinCommented:
The way to reach the data is to use Evaluate("Form.SN#SN_ITEM#").  That will dynamically evaluate the variable name and return its value.

e.g., inside your validation cfloop after the cfelse:

<cfset thesn=evaluate("Form.SN#SN_ITEM#")>
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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