I'm trying to make a silk purse out of a pig's ear :)I have a form where purchasers can deselect items they've added to their shopping cart. All the hidden fields have been numbered according to the items they *originally* selected. If they deselect an item, then it will probably necessitate a renumbering of all those hidden fields, since PayPal doesn't tolerate misnumbering: everything must be numbered "1" for all the hidden fields of the first product, "2" for the second, etc. If the customer selects 5 products and deletes the 3rd, then I need to renumber. I wrote a script that can do that. Now, I have to send the form to that script, with all its lovely hidden fields, then reproduce it somewhere so I can send it off to PP. That is, the form must return from the called script to a new page and deliver all the renumbered hidden fields.TIA,Tony
-----Original Message-----
From: Tom Von Lahndorff <tom@modscape.com>
To: tonylabarbara@aol.com
Cc: lists@zopyx.com; zope@zope.org
Sent: Mon, 13 Aug 2007 4:59 pm
Subject: Re: [Zope] Form-Through-Script
can you describe what you're trying to do a little more clearly?
On Aug 13, 2007, at 4:29 PM, tonylabarbara@aol.com wrote:
Well it didn't like that, either:Invalid requestThe parameter, doc, was omitted from the request.
again. But look here:
<td tal:define="docs here/CheckOutAfterEditStuff"><form action="renumberTheCart(docs)" method="post" enctype="multipart/form-data">
<p metal:use-macro="here/CheckOutAfterEditStuff/macros/main" />
See, I have a definition of "docs", but it's not pointing to a "use-macro" widget. Must be the problem, but how do I do that?
TIA,
Tony
-----Original Message-----
From: Tom Von Lahndorff <tom@modscape.com>
To: tonylabarbara@aol.com
Cc: lists@zopyx.com; zope@zope.org
Sent: Mon, 13 Aug 2007 4:20 pm
Subject: Re: [Zope] Form-Through-Script
I think you want:<form action="renumberTheCart(here/CheckOutAfterEditStuff)" method="post" enctype="multipart/form-data"><td><form action=http://example.com/s/renumberTheCart" method="post"><input type="hidden" name="doc" value="" tal:attributes="value here/CheckOutAfterEditStuff" /><p metal:use-macro="here/CheckOutAfterEditStuff/macros/main" /></td>(my tal may be a bit off)
On Aug 13, 2007, at 4:09 PM, tonylabarbara@aol.com wrote:
No, it should work the way it is...that is a URL I passed. I changed it to an absolute URL just to double-check, and got basically the same error:Invalid requestThe parameter, doc, was omitted from the request.
How do I pass the parameter, which in my case is quite long and stashed neatly away in a PT macro?
<td tal:define="docs here/CheckOutAfterEditStuff">
<form action=http://example.com/s/renumberTheCart?doc=docs" method="post">
<p metal:use-macro="here/CheckOutAfterEditStuff/macros/main" />
</td>
TIA,
Tony
-----Original Message-----
From: Andreas Jung <lists@zopyx.com>
To: tonylabarbara@aol.com; zope@zope.org
Sent: Mon, 13 Aug 2007 3:55 pm
Subject: Re: [Zope] Form-Through-Script
--On 13. August 2007 15:39:40 -0400 tonylabarbara@aol.com wrote:
>
> Hi;
> I have a form that I need to send to a script and then send off to a URL
> (PayPal). I need to process it through the script to renumber things for
> PP. How do I do this? I imagine I add an element to the PT like so:
>
> <form action="renumberTheCart(here/CheckOutAfterEditStuff)" method="post">
>
> but I need to pass a parameter "doc", which, of course, is the document
> I'm submitting. So I tried this:
>
> <form action="renumberTheCart(here/CheckOutAfterEditStuff)" method="post">
> <p metal:use-macro="here/CheckOutAfterEditStuff/macros/main" />
You might check out the basics about HTML forms first. The 'action' parameter is an URL and *not* some Python-like function call. You specify the destination URL inside the action attribute and pass the parameters as *hidden* form parameters to the URL - either using method GET or POST.
You'll find more on forms in any HTML tutorial. Start from here:
<http://www.w3schools.com/html/html_forms.asp>
-aj
_______________________________________________** No cross posts or HTML encoding! **(Related lists -
=
=