[Zope] Need help with ':records' form construct

Thomas B. Passin tpassin@mitretek.org
Mon, 16 Apr 2001 10:20:17 -0400


You need to do two things:

1) Start SIMPLE - create something tiny in Filemaker, and learn how to get
it working first.

2) Give us something useful to think about.  You have said the equivalent of
"My car doesn't work.  I tried to start it two different ways.  What's wrong
with it?"

Looking at the form data using <dtml-var REQUEST> is the right idea, but
it's better to use <dtml-var "REQUEST.form">.

One thing that can cause problems, I have found, is this.  If you have an
HTML form that has several fields with the same name - as you might get with
an automatically-generated form - the form returns them all in a list of the
same name.  That is, a variable personid might be returned as

personid:['23','64']

if there were two personid fields in the form.  But if there is only one,
the form returns

personid:23

which is not a list.  <dtml-in> does not work with the second example, since
there is no list to interate over.  You have to test the length of the form
variable to find out whether to use <dtml-in>.

Another complication is that you can get the form variables two ways:

1) "REQUEST.personid"
2) "REQUEST.form['personid']"

These two expressions are NOT the same!  I have found that the first gives
you a string, not a list, and you can't iterate over it, even though it
looks just like a list when you render it.  To use <dtml-in>, you must use
form 2).  I have no idea why, but I spent a lot of time recently wrestling
with exactly this quirk.

I don't know what your problems are,  but these two points helped me a lot.

Cheers,

Tom P

Chris Beaumont asked -


>
> I have a long form which contains information from around 100
> separate database records..
>
> This is being sent into Zope from a FileMaker form.. Its displayed in
> a long Zope form (it displays properly...) and edited.. and then I'm
> hoping to submit it from Zope and use the information to populate a
> SQL database via a ZSQL method.. I've tried two different ways to get
> it into my database, both iterating through the results and calling
> the SQL method on each iteration, and also doing my dtml-in in the
> ZSQL method itself. Neither have worked..
>