[Zope] Help with DTML Forms

Greg & Janet LINDSTROM yuba@cyberback.com
Thu, 1 May 2003 22:11:53 -0500


This is a multi-part message in MIME format.

------=_NextPart_000_0005_01C3102E.ABC59AA0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I would like to create a DTML Form that may be called with or without an =
argument (say, member_number).  I have tried something like this, a DTML =
Form named AddAddressForm:

<dtml-var standard_arfs_header>

<dtml-form method=3Dpost action=3DAddAddress>
  <table>
  <dtml-unless member_number>
    <tr>
       <th>Member Number</th>
       <td><input type=3Dtext name=3Dmember_number></td>
    </tr>
  </dtml-unless>
  <tr>
     <th>Address</th>
     <th>City</th>
  </tr>
  <tr>
        <td><input type=3Dtext name=3Daddress type=3Dstring></td>
        <td><input type=3Dtext name=3Dcity type=3Dstring></td>
  </tr>
  <tr>
        <td colspan=3D2><input type=3Dsubmit></td>
  </tr>
</table>
</dtml-form>

My intent is to have a form that, if called with no input paramters, =
will display a field so I can enter the member_number.  If the form is =
called with an input parameter, the member_number field will not be =
displayed, but the passed in value will be passed on to the AddAddress =
Method.

The AddAddress method called by the form is a DTML Method which, in =
turn, calls a ZSQL Method to add the information to the database.

The AddAddressForm will be called from another DTML Form.  The line =
calling the above code looks like this:

 <a =
href=3D"......./AddAddress?member_number=3D&dtml-member_number;">Add</a>

The only way I can "see" the member_number in the AddAddressForm is to =
use <dtml-var member_number>.  The shorthand _['member_number'] and =
&dtml-member_number; do not seem to work.  Is this because of the =
namespace issues with the DTML Form?

Am I trying to do too much here?  I could make two forms, but I don't =
like the idea of maintaining two nearly identical forms.  Can this be =
done?

Thanks for your help.

--greg

------=_NextPart_000_0005_01C3102E.ABC59AA0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I would like to create a DTML Form that =
may be=20
called with or without an argument (say, member_number).&nbsp; I have =
tried=20
something like this, a DTML Form named AddAddressForm:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&lt;dtml-var =
standard_arfs_header&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&lt;dtml-form method=3Dpost=20
action=3DAddAddress&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; &lt;table&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; &lt;dtml-unless=20
member_number&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; =
&lt;tr&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;th&gt;Member Number&lt;/th&gt;</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;&lt;input =
type=3Dtext=20
name=3Dmember_number&gt;&lt;/td&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; =
&lt;/tr&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; =
&lt;/dtml-unless&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; &lt;tr&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;th&gt;Address&lt;/th&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;th&gt;City&lt;/th&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; &lt;/tr&gt;</FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2>&nbsp;&nbsp;&lt;tr&gt;</FONT></DIV><FONT face=3DArial=20
size=3D2>
<DIV><FONT face=3DArial =
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;td&gt;&lt;input type=3Dtext name=3Daddress =
type=3Dstring&gt;&lt;/td&gt;
<DIV><FONT face=3DArial =
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;td&gt;&lt;input type=3Dtext name=3Dcity=20
type=3Dstring&gt;&lt;/td&gt;</FONT></DIV></FONT></DIV>
<DIV></FONT><FONT face=3DArial size=3D2>&nbsp; &lt;/tr&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&lt;tr&gt;</FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td=20
colspan=3D2&gt;&lt;input type=3Dsubmit&gt;&lt;/td&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; &lt;/tr&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&lt;/table&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&lt;/dtml-form&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>My intent is to have a form that, if =
called with no=20
input paramters, will display a field so I can enter the =
member_number.&nbsp; If=20
the form is called with an input parameter, the member_number field will =
not be=20
displayed, but the passed in value&nbsp;will be passed on to the =
AddAddress=20
Method.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The AddAddress method called by the =
form is a DTML=20
Method which, in turn, calls a ZSQL Method to add the information to the =

database.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The AddAddressForm will be called from =
another DTML=20
Form.&nbsp; The line calling the above code looks like =
this:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&lt;a=20
href=3D"......./AddAddress?member_number=3D&amp;dtml-member_number;"&gt;A=
dd&lt;/a&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The only way I can "see" the =
member_number in the=20
AddAddressForm is to use &lt;dtml-var member_number&gt;.&nbsp; The =
shorthand=20
_['member_number'] and &amp;dtml-member_number; do not seem to =
work.&nbsp; Is=20
this because of the namespace issues with the DTML Form?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Am I trying to do too much here?&nbsp; =
I could make=20
two forms, but I don't like the idea of maintaining two nearly identical =

forms.&nbsp; Can this be done?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks for your help.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>--greg</FONT></DIV></BODY></HTML>

------=_NextPart_000_0005_01C3102E.ABC59AA0--