I wouldnt do this bcause when your looking at large forms, you will end up
createing more HTML for the browser to render, thus the page taking longer
to display, and also giving more work to the CF server aswell to produce the
HTML for the page.


<cfloop query="myQuery">
    <input type="text" name="field_#currentrow#" value="#price#">
    <input type="hidden" name="priceID_#currentrow#" value="#priceID#">
 </cfloop>

Regards

Steve Onnis
Domain Concept Designs
+61 422 337 685
+61 3 9444 7504

http://www.domainconceptdesigns.com <http://www.domainconceptdesigns.com>

("If you think it can't be done, you haven't asked me!") - Steve Onnis





-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Adam
Chapman
Sent: Wednesday, January 08, 2003 11:45 AM
To: CFAussie Mailing List
Subject: [cfaussie] RE: Multiple Updates in forms


Well i agree with you on the Evaluate() issue..
but like i said "Below is a very crude example"

But i dont agree that using the "CurrentRow" like
this isnt very good.

Why not just

<cfloop query="myQuery">
    <input type="text" name="field_#currentrow#" value="#price#">
    <input type="hidden" name="priceID_#currentrow#" value="#priceID#">
 </cfloop>

then (note the use of one query.. hopefully your chosen
database supports this..)

<cfquery>
<cfloop from=1 to=#form.priceCount# index="i">
UPDATE  Prices
SET             Price = #form["field_#i#"]#
WHERE           PriceID = #form["priceID_#i#"]#;
</cfloop>
</cfquery>

Horses for courses.. one could argue that list
processing is slow?

Regards,
Adam


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Steve Onnis
Sent: Wednesday, 8 January 2003 11:33 AM
To: CFAussie Mailing List
Subject: [cfaussie] RE: Multiple Updates in forms



Firstly, apparently you shouldnt use Evaluate() cause it takes longer to
process.

I would use this
-------------------
<cfoutput>
        <cfloop from=1 to=#form.priceCount# index="i">
                #form["field_#i#"]#<br>
        </cfloop>
</cfoutput>
------------------

Secondly, using the "CurrentRow" like this isnt very good.  You have no way
of knowing what row to update in your when you run your action.cfm script.

I would suggest using a unique ID from the query and pass that list if IDs
to the action form like this
--------------------------------------------------------------
<cfoutput>
<form name="myForm" action="action.cfm">
<input name="priceIDs" type=hidden value="#ValueList(myQuery.TableID)#">
  <cfloop query="myQuery">
    <input type="text" name="field_#TableID#" value="#price#">
  </cfloop>
</form>
</cfoutput>
--------------------------------------------------------------

This way when you do your update you can refernce a specif field in your
query to update
-------------------------------------------
<cfloop list="#form.priceIDs#" index="id">
        <cfquery>
                UPDATE  Prices
                SET             Price = #form["field_#id#"]#
                WHERE           PriceID = #id#
        </cfquery>
</cfloop>

Right idea though

Regards

Steve Onnis
Domain Concept Designs
+61 422 337 685
+61 3 9444 7504

http://www.domainconceptdesigns.com <http://www.domainconceptdesigns.com>

("If you think it can't be done, you haven't asked me!") - Steve Onnis





-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Adam
Chapman
Sent: Wednesday, January 08, 2003 11:12 AM
To: CFAussie Mailing List
Subject: [cfaussie] RE: Multiple Updates in forms


Hi Christian,

If you dynamically name your form fields you can so this
quite easily. Below is a very crude example.

form page
---------
<cfoutput>
<form name="myForm" action="action.cfm">
<input name="priceCount" type=hidden value="#myQuery.recordcount#">
  <cfloop query="myQuery">
    <input type="text" name="field_#currentrwo#" value="#price#">
  </cfloop>
</form>
</cfoutput>

action.cfm
-----------
<cfoutput>
<cfloop from=1 to=#form.priceCount# index="i">
#Evaluate("form.field_#i#")#<br>
</cfloop>
</cfoutput>

Regards,
Adam Chapman

Virtualtours.com.au
mailto:[EMAIL PROTECTED]
Phone: 1300 366 122
(Int: +61 3 9720 5733)
Fax: +61 3 9720 6377)


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Christian
van der Plaat
Sent: Wednesday, 8 January 2003 11:00 AM
To: CFAussie Mailing List
Subject: [cfaussie] Multiple Updates in forms


I have a client that want to be able to update the prices in a category, the
hard part is he wants all the prices listed on one page in text boxes so he
can update the 20 or so prices for that category by clicking on the  one
submit button so the form will then update the 20 database listings rather
than updating one field at a time.

How can I do this? I saw it in Coldfusionjournal.com some where but I can
not find it.


Thank you

Christian van der Plaat
Advanced Web Designs - IT3



---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/


---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/


---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/


---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/


---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

Reply via email to