>- see footer for list info -<
Its not especially long winded, you are going to have to check each action
regardless or how you do it.

You could however do it like this.

All your buttons are called CartAction with the action as the value

E.g.

<input type="submit name="CartAction" value="AddToCart">
<input type="submit name="CartAction" value="RemoveFromCart"> 

And just pass that action to your CFC, and the rest of the form fields as
the arguments, thus doing away with all your cfinvokes below.

E.g.

<cfif StructKeyExists(form,'CartAction')>
        <cfinvoke component="shoppingcart" method="#form.CartAction#"
argumentcollection="#form#"></cfinvoke>
</cfif>

--
Russ

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Damien Gallagher
Sent: 17 May 2006 11:53
To: Coldfusion Development
Subject: [CF-Dev] form handling

>- see footer for list info -<
Hi all,

I have a shop/cart app I developed a while ago and I'm updating.

There are various steps to purchase (choose / update / checkout / buy /
etc...) with forms controlling each. I originally developed it so that the
form submits are handled by a single file which invokes CFC's or redirects
as necessary. It does this as follows:

<cfif IsDefined("form.buy")>
    <cfinvoke ...>
<cfelseif IsDefined("form.updateCart")>
    <cfinvoke ...>
<cfelseif IsDefined("form.clearCart")>
    <cfinvoke ...>
    <cflocation...>

and so on.

This seems a bit longwinded. My question is: is there any better way of
handling lots of related forms?

Thanks, Damien

_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help 
>-<


_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<

Reply via email to