[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Creating Dynamic Form Fields.

Posted on 2003-12-06
4
Medium Priority
?
201 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 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
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…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month18 days, 16 hours left to enroll

834 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