[Zope] control of layout in ZPT
Michael Havard
nhavar@hotmail.com
Fri, 13 Jun 2003 20:17:46 +0000
You're trying to call youremail out the scope of where it's defined. In the
first block the input is within the TD block where youremail is defined. In
the second block the youremail is called within another TD block outside of
the TD block where youremail has been defined.
Something else you may want to think about is to stop using tables for
layout control. CSS offers you significantly more control and is much less
complex than messing with tables.
for example: borrowing some tips from alistapart.com
><tr >
> <th align="left">
> <font size=5><font face="verdana"><b>
> Your Name:
> </b></font></font>
> </th>
> <td tal:define="yourname request/YourName|nothing"><input type="text"
>name="YourName"
> tal:replace="structure python:form.YourName.render(yourname)" />
> </td>
>
><td tal:define="youremail request/YourEmail|nothing">
> <font size=5><font face="verdana"><b>
> Your Email Address:
> </b></font></font>
> </td>
>
> <td><input type="text" name="YourEmail"
> tal:replace="structure
>python:form.YourEmail.render(youremail)">
> </td>
> </tr>
could become:
<div class="row">
<span class="label">Your Name:</span>
<span class="fld" tal:define="yourname request/YourName|nothing">
<input type="text" name="YourName"
tal:replace="structure
python:form.YourName.render(yourname)" />
</span>
</div>
<div class="row">
<span class="label">Your Email Address:</span>
<span class="fld" tal:define="yourname request/YourName|nothing">
<input type="text" name="YourEmail"
tal:replace="structure
python:form.YourEmail.render(youremail)">
</span>
</div>
Then if you define your CSS properly you just line to two divs next to each
other and you have a continuous row with multiple fields. This also gives
you a nice clean seperation of structure vs. look and feel and more
flexibility in future maintenance. Using the FONT tag and Tables for layout
is for the past and should probably only be used if you absolutely have to
support IE4/NS4 and below. Fortunately about 98% of the market right now is
IE5+/NS6/Opera. If you absolutely must stick with using the font tag and
tables use ONE font tag for formatting <font size="5" face="verdana"> and I
believe that most user agents automatically bold any text headers for the
table so there's not much sense in using <B> for those elements.
>From: pradeep behera <pradeepdeveloper@yahoo.com>
>To: zope@zope.org
>Subject: [Zope] control of layout in ZPT
>Date: Fri, 13 Jun 2003 06:24:04 -0700 (PDT)
>MIME-Version: 1.0
>Received: from mail.python.org ([12.155.117.29]) by
>mc10-f27.bay6.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Fri, 13
>Jun 2003 06:25:15 -0700
>Received: from localhost.localdomain ([127.0.0.1] helo=mail.python.org)by
>mail.python.org with esmtp (Exim 4.05)id 19QoYK-00028k-00; Fri, 13 Jun 2003
>09:25:12 -0400
>Received: from web20710.mail.yahoo.com ([216.136.226.183])by
>mail.python.org with smtp (Exim 4.05)id 19QoXG-00026G-00for zope@zope.org;
>Fri, 13 Jun 2003 09:24:06 -0400
>Received: from [203.193.149.237] by web20710.mail.yahoo.com via HTTP; Fri,
>13 Jun 2003 06:24:04 PDT
>X-Message-Info: EoYTbT2lH2MsQxQLKd6QGpQxvU17UYmU
>Message-ID: <20030613132404.73809.qmail@web20710.mail.yahoo.com>
>X-Spam-Status: No, hits=3.5 required=5.0
>tests=BIG_FONT,FROM_BIGISP,HTML_FONT_COLOR_BLUE,MIME_ALTERNATIVE,SPAM_PHRASE_08_13,SPAM_REDIRECTOR
>X-Spam-Level: ***
>Sender: zope-admin@zope.org
>Errors-To: zope-admin@zope.org
>X-BeenThere: zope@zope.org
>X-Mailman-Version: 2.0.13 (101270)
>Precedence: bulk
>List-Help: <mailto:zope-request@zope.org?subject=help>
>List-Post: <mailto:zope@zope.org>
>List-Subscribe:
><http://mail.zope.org/mailman/listinfo/zope>,<mailto:zope-request@zope.org?subject=subscribe>
>List-Id: Users of the Z Object Publishing Environment <zope.zope.org>
>List-Unsubscribe:
><http://mail.zope.org/mailman/listinfo/zope>,<mailto:zope-request@zope.org?subject=unsubscribe>
>List-Archive: <http://mail.zope.org/pipermail/zope/>
>Return-Path: zope-admin@zope.org
>X-OriginalArrivalTime: 13 Jun 2003 13:25:15.0810 (UTC)
>FILETIME=[39F80820:01C331AF]
>
>
>Hi,
>
>I want to use formulator for designing my forms. However it does not allow
>more than one field to be presented in the same row (a requirement for my
>form).
>
>I am using the example from this URL
>http://www.zope.org/Members/beno/HowTo/HowTo/Formulator_With_ZPT
>
>The difficulty I am facing is that the sample code uses:
>
> <tr tal:define="yourname request/YourName|nothing">
> <th align="left">
> <font size=5><font face="verdana"><b>
> Your Name:
> </b></font></font>
> </th>
> <td><input type="text" name="YourName"
> tal:replace="structure python:form.YourName.render(yourname)" />
> </td>
></tr>
>
>for each row. To make 2 fields appear in the same row, i am trying to do
>this:
>
>
> <tr >
> <th align="left">
> <font size=5><font face="verdana"><b>
> Your Name:
> </b></font></font>
> </th>
> <td tal:define="yourname request/YourName|nothing"><input type="text"
>name="YourName"
> tal:replace="structure python:form.YourName.render(yourname)" />
> </td>
>
><td tal:define="youremail request/YourEmail|nothing">
> <font size=5><font face="verdana"><b>
> Your Email Address:
> </b></font></font>
> </td>
>
> <td><input type="text" name="YourEmail"
> tal:replace="structure
>python:form.YourEmail.render(youremail)">
> </td>
> </tr>
>
>However I am getting errors
>Error Type NameError
>Error Value name 'youremail' is not defined
>
>Can you please help me resolve this.
>
>Thanks
>Pradeep
>
>
>
>
>---------------------------------
>Do you Yahoo!?
>Free online calendar with sync to Outlook(TM).
_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail