"you need an "H" in your where clause ;)"

"an" is only used when it is proceded by a vowel :)

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 Toby
Tremayne
Sent: Wednesday, January 08, 2003 1:39 PM
To: CFAussie Mailing List
Subject: [cfaussie] RE: Multiple Updates in forms


-----BEGIN PGP SIGNED MESSAGE-----
Hash: MD5

Hi Christian,

   you need an "H" in your where clause ;)

Wednesday, January 8, 2003, 1:33:58 PM, you wrote:

CvdP> Thanks for your help, I am nearly there but I just cant seem to get
the
CvdP> action page to work.

CvdP> For the display page I am using:
CvdP> ========================

CvdP> <form name="form1" method="post" action="testprice2.cfm">
CvdP>   <cfloop query="gtProds">
CvdP>     <cfoutput>
CvdP>         <cfset totrows =  #currentrow#>
CvdP>       #gtProds.prodID#
CvdP>       <input type="text" name="field_#currentrow#"
CvdP> value="#Trim(gtProds.RetailPrice)#">
CvdP>       <input type="hidden" name="prodID_#currentrow#"
CvdP> value="#gtProds.prodID#">
CvdP>       <BR>
CvdP>     </cfoutput>
CvdP>   </cfloop>
CvdP> <input type="submit" name="Submit" value="Update">
CvdP> <input name="totrows" type="hidden" id="totrows"
CvdP> value="<cfoutput>#totrows#</cfoutput>">
CvdP> </form>


CvdP> =======================
CvdP> For the Action page I am using
CvdP> =======================

CvdP> <cfloop from=1 to=#form.totrows# index="i">
CvdP> <cfquery datasource="timber">
CvdP> Update Product
CvdP> SET RetailPrice=#form["field_#i#"]#
CvdP> WERE prodID=#form["prodID_#i#"]#
CvdP> </cfquery>
CvdP> </cfloop>

CvdP> ==================
CvdP> I get the error
CvdP> ODBC Error Code = 37000 (Syntax error or access violation)

CvdP> [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing
operator) in
CvdP> query expression '4.0000 WERE prodID=142'.
CvdP> =================

CvdP> It should work, I cant figure out why its not.

CvdP> Any ideas?


CvdP> Thank you

CvdP> Christian van der Plaat
CvdP> Advanced Web Designs - IT3





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



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


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

CvdP> Regards

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

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

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





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


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

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

CvdP> Why not just

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

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

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

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

CvdP> Regards,
CvdP> Adam


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



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

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

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

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

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

CvdP> Right idea though

CvdP> Regards

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

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

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





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


CvdP> Hi Christian,

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

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

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

CvdP> Regards,
CvdP> Adam Chapman

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


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


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

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


CvdP> Thank you

CvdP> Christian van der Plaat
CvdP> Advanced Web Designs - IT3



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

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


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

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


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

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


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

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


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

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



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

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







 ---------------------------------------

             Life is poetry -
               write it in your own words.

 ---------------------------------------

Toby Tremayne
Technical Team Lead
Code Poet and Zen Master of the Heavy Sleep
Toll Solutions
154 Moray St
Sth Melbourne
VIC 3205
+61 3 9697 2317
0416 048 090
ICQ:  13107913

-----BEGIN PGP SIGNATURE-----
Version: 2.6

iQCVAwUAPhuPSEYhrxxXvPlFAQFnVQP/TD8ni2+ungBjtsx05LbcmHsIT+R+dD5m
byoZETtnQqxWpqNInflKUggcGGQUstVNRpsiNeqO9CxR2UTPrdQe6I1bya9VmPkc
ocA2S17y/HJqeWqH/JsSZfUQ+ylkMYBgB8uQrtB4OljN6+9nNvY+xm3U4LiCoi6c
phfyuQnTYkU=
=leXA
-----END PGP SIGNATURE-----


---
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