Re: Client side TAL implementation

Phillip Hutchings <[email protected]>
Newsgroups gmane.comp.web.zope.page-templates
Message-ID <[email protected]>
> My question is: Is TAL meant to support data formatting or only data
> displaying? Could we for instance implement something like this: 
>
> <span tal:content=" /data/myname|capitalize"> 
> 
> I may be in a complete wrong track, but any suggestion or comments would be
> greatly appreciated! 

TAL itself can't handle processing of retrieved data, it's only for
data fetching. To do this you'd ideally create a data object that
knows how to capitalise itself, and do something like:
<span tal:content="/data/myname/capitalize">
Deferring to US spelling for the function call, to make it consistent
with most other things.

This isn't great MVC however, so a better way would be to follow your
original idea of calling a JS function, as in Zope you'd use a python
expression somewhat like this, depending on where you keep your
capitalize method:
<span tal:content="python:container.capitialize(data.myname)">
Though I'd recommend creating a string object with capitialize in its prototype:
<span tal:content="javascript:string.Capitalize(data/myname)">

-- 
Phillip Hutchings
http://www.sitharus.com/
[email protected] / [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.