Solved

Creating Dynamic Form Fields.

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

Simple, centralized multimedia control

Watch and learn to see how ATEN provided an easy and effective way for three jointly-owned pubs to control the 60 televisions located across their three venues utilizing the ATEN Control System, Modular Matrix Switch and HDBaseT extenders.

Question has a verified solution.

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

What You Need to Know when Searching for a Webhost Provider
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

688 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