• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to access the form items dynamically

Community Beginner ,
Jun 04, 2009 Jun 04, 2009

Copy link to clipboard

Copied

The issue here is that I want to acces the value in the textboxes dynamically



Here is the code ( I know its wrong )



<cfset temp = TaskEntryIDs.Split(',') />



    <cfloop index="x" from="1" to="#arrayLen(temp)#">
   
    <cfset TempControl = "Form.t"&temp>
    <cfif isdefined("Form.t"&temp)>
         <cfoutput>#"Form.t"&temp#</cfoutput><br/>
    </cfif>
    </cfloop>



I don't know the correct way to access it, I know that the textbox name start with T and the task number



I know that the textbox for the task number 74 is t74, but how can I access the value of this text box so I can insert it into to the database ?



Please help me



Thanks

TOPICS
Advanced techniques

Views

383

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 04, 2009 Jun 04, 2009

Copy link to clipboard

Copied

LATEST

Array Notation:

Form["t" & temp]

StuctKeyExists() is an easier function to determine dynamic form fields exist.

<cfif structKeyExists(form,"t" & temp)>  rather then isDefined().

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation