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
Solved

Creating Dynamic Form Fields.

Posted on 2003-12-06
4
196 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
  • 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

Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

Question has a verified solution.

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

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

837 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