[Zope] Form-Through-Script

tonylabarbara at aol.com tonylabarbara at aol.com
Tue Aug 14 10:18:47 EDT 2007


I don't think I've misunderstood you and I have done what I believe I understand you to say. I can't check the browser (generated)?code because I get an error stating I haven't passed the requisite variable to the script. The variable is the entire document, or at least the hidden variables. They aren't being passed to the script and I don't know how to do that. 



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. 



Let me summarize what I've written before to put in one post exactly what's going on:


1)?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" />

which renders my page fine, but throws an error when I submit the form:

Cannot locate object at: http://example.com/s/c/x/j/en-us/s/renumberTheCart%28here


2) I changed it to an absolute URL just to double-check, and got basically the same error:
?

Invalid request

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


Now, Tom Von Lahndorff suggested the following:


Sounds like the script should check to see if the user is removing something like:

<input type="checkbox" name="remove" value="item-374623746">




if remove

remove the item

redirect back to the udpated form page

else

send to PP




this way once the item is removed and the same script is called, since there's no remove this time, it'll go to PP.


I would LOVE to do that...if I knew how! Any ideas?
TIA,
Tony




-----Original Message-----
From: Andreas Jung <lists at zopyx.com>
To: tonylabarbara at aol.com; tom at modscape.com
Cc: lists at zopyx.com; zope at zope.org
Sent: Tue, 14 Aug 2007 12:43 am
Subject: Re: [Zope] Form-Through-Script




?

Invalid request

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


Now, Tom Von Lahndorff suggested the following:


Sounds like the script should check to see if the user is removing something like:

<input type="checkbox" name="remove" value="item-374623746">




if remove

remove the item

redirect back to the udpated form page

else

send to PP




this way once the item is removed and the same script is called, since there's no remove this time, it'll go to PP.


I would LOVE to do that...if I knew how! Any ideas?
TIA,
Tony




-----Original Message-----
From: Andreas Jung <lists at zopyx.com>
To: tonylabarbara at aol.com; tom at modscape.com
Cc: lists at zopyx.com; zope at zope.org
Sent: Tue, 14 Aug 2007 12:43 am
Subject: Re: [Zope] Form-Through-Script



?
--On 13. August 2007 17:40:35 -0400 tonylabarbara at aol.com wrote:?
?
>?
> I would LOVE to do that. I don't know how :( Can you point me to a good?
> tutorial or explain this a bit and give me some KW to chase down in?
> google??
>?
?
Tony, please think about what you're doing for a moment.?
?
If you want to call a method or a script XXX inside Zope through a form?
where the method expects parameters A and B then you have to write:?
?
<form action="XXX" method="get|post">?
?
<input type="hidden" name="A" tal:attributes="value context/some_method_providing_a" />?
<input type="hidden" name="B" tal:attributes="value context/some_method_providing_b" />?
?
Now apply this knowledge to your usecase. Check your _generated_?
code twice if all requirements are fulfilled.?
?
-aj?
?


________________________________________________________________________
AOL now offers free email to everyone.  Find out more about what's free from AOL at AOL.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20070814/a6b07b14/attachment.htm


More information about the Zope mailing list