*Now* I remember why I like Zope so much...

I'm using the ":records" to marshall a complex hierarchical form, and I'm a
little worried by this comment:



Before creating a second record and adding an attribute, Zope gets the last
record in the list and checks to see if that record has the attribute. If
the first record doesn't have the attribute, it inserts the attribute and
value instead of creating a new record. For example, if the user entered a
name and age for Member #1 and only an email for Member #2, the list will
have only one record. That record will contain the name and age attribute
from Member #1 as well as the email attribute from Member #2.

This isn't a problem for me, *except* <sigh>. I want to be able to tickbox
certain fields to delete them, as well as alter the values in the textboxes
to alter other fields. *BUT*, my HTML manual says that "CHECKBOX name/value
pairs are only submitted to the server if the field is checked"

So, I would expect this:

<dtml-var standard_html_header>

<dtml-if list><dtml-in list>
    <dtml-if b><td>&dtml-b;</td></dtml-if>

    <td><input type="text"     name="list.a:records"   value="1a"></td>
    <td><input type="checkbox" name="list.b:records" value="1b"></td>
    <td><input type="text"     name="list.a:records"   value="2a"></td>
    <td><input type="checkbox" name="list.b:records" value="2b"></td>
    <td><input type="text"     name="list.a:records"   value="3a"></td>
    <td><input type="checkbox" name="list.b:records" value="3b"></td>
    <td><input type="text"     name="list.a:records"   value="4a"></td>
    <td><input type="checkbox" name="list.b:records" value="4b"></td>

<input type="submit" value="test">

<dtml-var standard_html_footer>

To read:

3a 4b

If you just ticked the 4th listbox. But it doesn't - it works as I "want" it
to work, i.e. it reads:

4a 4b

Why? I'm glad this does, but as the saying goes, if you don't understand it,
it can bite you when you least expect it. I've tested this under netscape 6
and IE5.0.

I know I can work around it (set the value field of the checkbox to contain
the information it's referring to) but I'm curious as to what's going on. I
note that if you swap the textbox and checkbox around, it does indeed
"break", and the delete is associated with the previous record as you'd

So - I suspect the behavious of "records" changed at some point? My question
then becomes - does the HTML/HTTP spec guarantee that if I put the
checkboxes *after* the textboxes, and Zope is marshalling the records in a
useful fashion, this will always work on a conforming browser?


| Phil Mayers, Network Support     |
| Centre for Computing Services    |
| Imperial College                 |

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

Reply via email to