Solved

Creating Dynamic Form Fields.

Posted on 2003-12-06
4
197 Views
Last Modified: 2013-12-24
I Have a form inserting form fields into a SQL table

Insert Into Table_Name
(Sort, Display_Name, Field_Script)
Values
('1', 'Field One', '<input type="text" name="Field_One" value"##item_details.item_name##">')


That all works Fine...

Next I have a page that displays all records in the table in order to create a form page..

<cfset tablename=url.program>

<cfquery name="fields" datasource="dsn">
SELECT *
FROM [#tablename#]
Order by sort
</cfquery>

Then I want to output all records into dynamic form...

<form action="item_details.cfm">
      <tr>
<cfoutput query="fields">
            <td width="80">#fields.Display_Name#</td>
            <td width="50">#fields.Field_script#</td>
<cfif fields.currentrow mod 2 eq 0>
</tr><tr>
</cfif>
</cfoutput>
</tr>
</form>

My problem is when the page is viewed I am getting the #item_details.item_name# variable inside the text field.
It is as if Cold Fusion parses it once to get the data out of the database (the form field is visible and named correctly)
but the value come up as the variable its self.

I have tried the evaluate function with no luck.

<form action="item_details.cfm">
      <tr>
<cfoutput query="fields">
            <td width="80">#fields.Display_Name#</td>
            <td width="50">#evaluate("fields.Field_script")#</td>
<cfif fields.currentrow mod 2 eq 0>
</tr><tr>
</cfif>
</cfoutput>
</tr>
</form>

Please Help I need a fix or a work around for this.   Thanks in Advance

Joe
0
Comment
Question by:joebox
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 17

Accepted Solution

by:
anandkp earned 500 total points
ID: 9888248
try - #evaluate(de('fields.Field_script'))#

it shld work for u !

K'Rgds
Anand
0
 
LVL 17

Expert Comment

by:anandkp
ID: 9888262
thou after looking in closely - i wonder what are u trying to achieve ?
i mean why wld u wanna have a form element inside ur DB ? & from where do u plan to get the value "item_details.item_name" ? as at run time - u dont have a query with this name ...

just asking - as i got confused with ur logic / flow

let me know ...
0
 

Author Comment

by:joebox
ID: 9889229
Basically what i am trying to do is create a form that has static values of input fields.  Then the user can choose what type of fields they want to add to to a database. After the submit, it directs them to a page that has a cfquery on it that pulls all fields from the databse onto a dynamic form.  This would let the user add as many fields to the dynamic form page as they want.  Of course the <cfinput> tags are great for this because I wont have to change any sql for the insert or update.


anandkp your answer was in the right direction as it returned fields.field_script as the value of the text field.  I removed the '  ' and it worked fine.  Thanks for the help..  This place is great!!!  Joe
0
 
LVL 17

Expert Comment

by:anandkp
ID: 9894660
yeah - the single quotes shldnt have been there ! my apologies for the typo error !

gr8 going !

Cheers
Anand
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Coldfusion Datefield problem 2 125
Internal DNS Zone Issue 13 89
apply ddos protection on all network interface 2 132
Adding multiple JVM environments to RedHat 6 7 70
This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
What You Need to Know when Searching for a Webhost Provider
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question