Jim Penny wrote:
> > ...can also be written as:
> >
> > <tal:x repeat="x xes">
> > <tr>
> >  <td><tal:x replace="x/id"/></td>
> > </tr>
> > </tal:x>
> Interesting.  I seem to remember this from the Wiki's, is it documented
> anywhere else?  This really seems like Chapter 5 material.

No idea, but it definitely should be...

> > <tal:x repeat="fish fishes"
> >        define="species fish/species">
> Actually, the first time I got bit was on repeat v. condition.  I wanted
> the condition to test each row, not to guard the entire iteration
> process.

Yup, that's another common one, easily solved though:
<tal:x repeat="fish fishes">
<tal:x condition="fish/hasHead">
<!-- instructions for removing fish head here -->

> OK, off to add following comments to Zope Book ZPT Reference --
> Since the on-error statement is invoked ...
> +If multiple statements appearing within an element have the same
> +precedence level, the order of execution of those statements
> +within the precedence group is undefined.

...and that does suck :-S

> in any order they wish.  But, for TAL to be useful as a programming language,

TAL IS NOT A PROGRAMMING LANGUAGE!!! It is a templating language, and they are VERY
different animals...

> OK, consider a form like:
> <p>Error Message (may be replaced)</p>
> <form action=.>
>   Name: <input type=text name=name><br/>
>   Type:  <input type=checkbox name="social_skills" value="nerd" checked>nerd
>          <input type=checkbox name="social_skills" value="geek">geek
>          <input type=checkbox name="social_skills" value="mundane">mundane
>          ...
> </form>
> On entry I would like a default to be checked.  On call with an error
> message I would like the item that was most recently checked to remain
> checked.  For example, suppose I needed to prevent multiple definitions
> of the same name.  my validation routine could set error_message and
> then my tal would look like:
> <p tal:replace="structure contents | nothing">Error Message</p>
> <form action=.>
>   Name: <input type=text name=name tal:attributes="name request/name|nothing"><br/>
> But how do I elegantly handle checked element?  If checked were a true
> attribute (i.e. took form checked="1" or checked="0"), it would be
> clear!  But they aren't.

Oh but they are ;-) I was surprised by this, but HTML no longer has attributes without
values, and all browsers support it:

<tal:x define="social_skills request/social_skills | string:nerd"
       repeat="skill python:['nerd','geek','mundane']">
<input type=checkbox name="social_skills" value="nerd" 
       tal:attributes="checked python:social_skills==skill;">nerd



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

Reply via email to