[Zope] RE:How do I merge form URL vars into sql easily

2000-07-06 Thread Michael Blewett

Hi Jake,
I originally had trouble coming to grips with the concept of variables and 
forms and passing them from one object to the next. After much testing, 
trial and error (and guidance from this list), I came up with these 
conclusions (which I'm sure someone will shoot down if I am wrong):
1) The request object you are setting with your REQUEST.set command is like 
a big bucket that gets passed between one web page and the next when you 
call it in your DTML. The best thing someone ever showed me was how to view 
in the called document ie.

  insert the line:

dtml-var REQUEST

into the dtml/method you are trying to call.

If you do that you can see all of the variables that get passed normally as 
part of your REQUEST variable, as well as any that get added to it by your 
form in the act of your POST command in the form. Be prepared  - it is a 
long list! You should be able to see all your form variables in there. If 
you don't then you haven't been doing your form correctly (been there done 
that too!).
The only real 'nasty' I have come across so far id the checkbox - if it is 
unchecked it doesn't post anything to the REQUEST object, and then you need 
to check for it and set it,  if you are using it  to update an SQL database 
(this is the only time I use the dtml-call 
"REQUEST.set['argument','value']"command. This is normal behaviour with 
forms and is not the fault of Zope.


Hope this helps...

  - Michael




   -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
  [EMAIL PROTECTED]
  Sent: Wednesday, July 05, 2000 5:32 PM
  To: [EMAIL PROTECTED]
  Subject: [Zope] How do I merge form  URL vars into sql easily
 
 
  I am a new user to Zope and I'm trying to pass data that has been
  entered into a form (either through GET or POST) into another
  object.  This object calls a z sql method to insert the form data into
  the database.  So far, the only way I've found to pass data to the
  sql is to define arguments for it and then, in the dtml-document (or
  method) use:
  dtml-call "REQUEST.set['argument','value']"
  (and it took me long enough to figure THAT out, let me tell you)
  The problem is that sucks when there are 30 form varibles that
  need to be inserted into the database.
   I would think that there is some way to let the sql method see
  these varibles that are defined within my document.  Or loop
  through all URL or form varibles defined and sets all the vars in
  request. Something to keep from having to write the above dtml 30
  times.  Thanks.
 
  Jake Feasel
 
~~~
Michael Blewett
Computer Support Mgr - Biological Sciences
Monash University (Clayton Campus)
Victoria Australia 3168

" Can I trade this job for what's behind door #2? "


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] RE:How do I merge form URL vars into sql easily

2000-07-06 Thread R. David Murray

On Fri, 7 Jul 2000, Michael Blewett wrote:
 trial and error (and guidance from this list), I came up with these 
 conclusions (which I'm sure someone will shoot down if I am wrong):
 1) The request object you are setting with your REQUEST.set command is like 
 a big bucket that gets passed between one web page and the next when you 
 call it in your DTML. The best thing someone ever showed me was how to view 

Not that you are wrong, but just a bit of clarification for those
people who also haven't quite grasped the stateless nature of
http transactions:  it is probably better to say that the REQUEST
object gets passed (by the DTML machinery invisibly or by calling
dtml methods using the "methodname(_.None,_)" pattern) around
between one *method* and the next.

Once you generate an output page, the user views it, and then clicks
again, you have a brand new REQUEST object that can only get values
from the *new* web page.  Others have been tripped by this, expecting
the REQUEST fields to automatically carry over from one form to
the next.  They don't, unless you explicitly put hidden fields into
your form to store the variables values for the next REQUEST.
But as long as you are still server side and making DTML calls,
REQUEST is there.

--RDM


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] RE:How do I merge form URL vars into sql easily

2000-07-06 Thread Michael Blewett

At 20:39 6/07/2000 -0400, R. David Murray wrote:
snip


Once you generate an output page, the user views it, and then clicks
again, you have a brand new REQUEST object that can only get values
from the *new* web page.  Others have been tripped by this, expecting
the REQUEST fields to automatically carry over from one form to
the next.  They don't, unless you explicitly put hidden fields into
your form to store the variables values for the next REQUEST.
But as long as you are still server side and making DTML calls,
REQUEST is there.

Maybe I should have mentioned that my bucket gets emptied after each new 
page is requested...just to keep the analogy going...

Thanks for clarifying that - always happy to be corrected, especially if it 
makes things clearer.

  - Michael
~~~
Michael Blewett
Computer Support Mgr - Biological Sciences
Monash University (Clayton Campus)
Victoria Australia 3168

" Can I trade this job for what's behind door #2? "


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )