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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic form

Status
Not open for further replies.

theevilone

IS-IT--Management
Aug 19, 2001
52
GB
Hi,

I hope this decription of my proplem makes sense.

I am making a administrator and a customer page for an inventory checklist. The administrator can add/edit/delete records on the administrator page. The customer can view the updated page and checks a 'Yes' or 'No' radio button against each record and then hits submit.

Each record would typically contain fields such as inventoryid, description, stockno, yesno.

How can I capture the customer response and update the database, when the records would be dynamically created by the administrator.

Any help would be very much appreciated. If you need me to clarify the problem further, please ask.

Using Coldfusion MX, SQL Server 2000.

Thanks.
 
Maybe I'm misunderstanding the problem, but this should work:

<cfquery datasource=&quot;foo&quot;>

UPDATE blah
SET description = '#form.description#', stockno = '#form.stockno#', yesno = '#yesno#'
WHERE inventoryid = #form.inventoryid#

</cfquery>


 
It's a lot easier to do if you can change the design slightly so that the customer just checks a box for &quot;yes&quot; and leaves it blank for &quot;no&quot;. Then, what you would do is in your customer page, create one checkbox for each record where the name is whatever you want (but the same for every checkbox) and the value is the inventory id (or whatever your primary key is) for that record. Then, when the page is submitted, you get one form variable with the same name as all the checkboxes, and with a value of a comma-delimited list of all the values that were selected. Then your update query looks something like this:
Code:
<cfquery name=&quot;myUpdate&quot; datasource=&quot;myDSN&quot;>
  UPDATE myTable
  SET myColumn = 1
  WHERE inventoryID IN(#ListQualify(FORM.checkboxname,&quot;'&quot;,&quot;,&quot;,&quot;ALL&quot;)#)
</cfquery>
If the inventoryID field (or its equivalent) is an integer field, you don't even need to worry about the ListQualify() -- that just puts single quotes around each list item.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top