Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic form variables---

Status
Not open for further replies.

sahoo

Programmer
Aug 29, 2000
4
US
Hi,

The code you have written is not working for me.

I have a dynamic form where all the form element's names are taken from database. so it may be n1, gsd, sffr,sf like that.

What I am doing is taking all these into a hidden variable.

So may hiddenvariable name is suppose hvalue,

and the value is hvalue = Name,Age,Sex,Products etc.

what I am doing is splitting all these into a array and putting like this.

<cfset value=&quot;Form.&quot;&#Arr#>
If I print value then I am getting the following :

Form.Name
Form.Age
Form.Sex
Form.Products etc.

I want the value of the above. I dont want the string. Please help me to get the values.

I am attching my code also :

<cfoutput>
#form.NameOfActiveFields# - this is the array of names
</cfoutput>
<cfset FieldArr = ListToArray(#form.NameOfActiveFields#,&quot;,&quot;)>
<cfloop index=&quot;inti&quot; from=1 to= #arrayLen(FieldArr)#>
<cfoutput>
<Cfset code=&quot;Form.&quot; & #FieldArr[inti]#>
</cfoutput>
<cfquery name=&quot;inst&quot; datasource=&quot;max&quot; dbtype=&quot;ODBC&quot;>
INSERT INTO InsertFormData values (13,'#form.formid#','#FieldArr[inti]#','#code#','12')
</cfloop>

In code I am not getting values. I am getting a string like form.name etc.

Thanks.

-SAHOO
 
Use the evaluate function.

if value=&quot;form.name&quot;
then evaluate(value) will output the value of form.name

 
Hi Russ,

Thank you very much.

-SAHOO
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top