[Zope] Simple form problem (again)

Andrew Williams ajwms@visto.com
Thu, 27 Apr 2000 07:09:14 -0700


I am doing something similar with the site I am working 
on.  This is more of an HTML thing more than a Zope thing.  
Here is what I would do (untested):

<input type="button" value="Edit" name="edit" 
onclick="javascript:location.url='/your/url/here/index_html?
<dtml-var id>'&editrec=1">

<input type="button" value="Copy" name="copy" 
onclick="javascript:location.url='/your/url/here/index_html?
<dtml-var id>'&copyrec=1">

<input type="button" value="Delete" name="delete" 
onclick="javascript:location.url='/your/url/here/index_html?
<dtml-var id>'&deleterec=1">


Then in your method/document which handles the form, put:
<dtml-if editrec>
 ...stuff...
<dtml-elif deleterec>
 ...stuff...
<dtml-elif copyrec>
 ...stuff...
</dtml-if>

The only warning I have is that I'm not sure on 
the "javascript:location.url" part.  I'm at home today and 
haven't copied my stuff from zip disk to the home pc.


Andrew



-----Original Message-----
From:    Geoff Gardiner ggardiner@synomics.com
Sent:    Thu, 27 Apr 2000 13:45:00 +0100
To:      zope@zope.org
Subject: [Zope] Simple form problem (again)


Sorry to return to the simple multi-button problem, sorry, 
sorry; but I just
can't get it to work in Zope.

I have a table whose rows I want to copy or edit or delete, 
so I put 3
buttons on each row. The buttons are all of type 'submit', 
the 3 have names
'copy', 'edit' and 'del', and all the buttons on a row have 
a unique value
that references the row.

However, when any button is pressed, ALL the buttons are 
valid according to
the REQUEST, in three dictionaries 'copy', 'edit' and 'del' 
(and there's no
'submit' entry). And I can't get hold of the unique value 
of any of them - I
just get the text I'm displaying on the button, which is 
non-unique. All
details below.

This seems to contravene the HTML4 spec, and what's been 
discussed here
recently, since I would expect a single valid name / value 
pair. So I
suppose I'm doing something wrong again, but I would very 
much like somebody
to point me in the right direction.

Thank you in advance,
Geoff Gardiner


Platform
--------
Win NT4 SP5 IE5 Zope 2.1.6

DTML source
-----------
<form action="testform" method="POST">
...
<dtml-with "Data">
  <dtml-in "objectValues()" sort=item_lc>
    <dtml-if "item<>''">
    <tr>
      <td><dtml-var "item"></td>
      <td><dtml-var "definition"></td>
      <td><dtml-var "notes"></td>
      <td align="center"><BUTTON name="copy" value="<dtml-
var id>"
type="submit">Copy</BUTTON></td>
      <td align="center"><BUTTON name="edit" value="<dtml-
var id>"
type="submit">Edit</BUTTON></td>
      <td align="center"><BUTTON name="del" value="<dtml-
var id>"
type="submit">Del</BUTTON></td>
    </tr>
    </dtml-if>
  </dtml-in>
</dtml-with>
...
</form>

Renders as
----------
Item   Definition    Notes         Copy   Edit   Del
A1     A defintion2 Notes2 of it  <Copy> <Edit> <Del>
B2     A defi1ntion Notes o1f it  <Copy> <Edit> <Del>
C3     Another def  Notes of it   <Copy> <Edit> <Del>

Source viewed as
----------------
...
    <tr>
      <td>B2</td>
      <td>A defi1ntion</td>
      <td>Notes o1f it</td>
      <td align="center"><BUTTON name="copy" value="abcdef1"
type="submit">Copy</BUTTON></td>
      <td align="center"><BUTTON name="edit" value="abcdef1"
type="submit">Edit</BUTTON></td>
      <td align="center"><BUTTON name="del" value="abcdef1"
type="submit">Del</BUTTON></td>
    </tr>
...

Posted on testform, using <dtml-var REQUEST> shows 
REQUEST.form as
------------------------------------------------------------
------
form
del ['Del', 'Del', 'Del']
copy ['Copy', 'Copy', 'Copy']
edit ['Edit', 'Edit', 'Edit']



_______________________________________________
Zope maillist  -  Zope@zope.org
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 )




__________________________________________________________________________
Visit http://www.visto.com/info, your free web-based communications center.
Visto.com. Life on the Dot.