Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

passing parameter in hyperlink - setting form.submit = whatever ?

Participant ,
Jun 07, 2010 Jun 07, 2010

I know regular parameters can be passed via a URL

but I have a "checkout" button. The only way to view the checkout screen is to goto the shoppingCart form and click the submit button "checkout"

Is there a way I can create a link for the user, to click on a"checkout" button, without having to goto the above screen ?

eg. <a href="shoppingCart?form.submit="checkout">link</a>

TOPICS
Getting started
643
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 07, 2010 Jun 07, 2010

ok, I solved this eventually by passing a regular parameter in the url

then I used

<cfif form.submit = "checkout" or isdefined ("URL.checkout")>

run the checkout code

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 07, 2010 Jun 07, 2010

Store all your data in a session variable and process the session variable in your checkout page.  Then you don't need url variables.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 07, 2010 Jun 07, 2010

it's my first shopping cart so go easy on me!

viewCart.cfm displays the shopping cart, along with 2 submit buttons

one to update qty

one to checkout

the form action calls viewCart.cfm, and branches to appropriate code path based on form.submit = checkout or update

so in order to reach the checkout screen I need form.submit = checkout set, hence why I couldn't hyperlink to the checkout page

hindsight is a wonderful thing, and next time, I'll write a RAM based cart, which you can change row qty dynamically in the form (I'm guessing that's possible?!) I'll also start using CFC's and the like.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 07, 2010 Jun 07, 2010
LATEST

I think I've learned not to have a total reliance on session vars

For example holding the users cart in a session based struct is one thing, but them completing checkout (having debited the users card) only to find the session vars have expired before you've inserted them into a table is something I wish to avoid!

I use a mix of session vars and a webCart table in the database. Any orders that are 'checked out', get transferred from the temporary webCart and put in the "orders" & "ordered_merchandise" tables

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources