Dynamic form. name

ChirsJB used Ask the Experts™
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.


<CFLOOP INDEX="SN_Item" FROM="1" TO="#variables.sn_qty#" STEP="1">
      <TD>Serial Number Item: #SN_Item#</TD>
      <TD><INPUT TYPE="text"

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


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

<!--- 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.
          READ/GET DATA HERE!!!


Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
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#")>

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial