[ZPT] How can I place a semicolon (;) in a tal string?
Jeff Peterson
jpeterso@rangebroadband.com
Fri, 18 Jan 2002 11:43:02 -0600
Escape it by placing another ";" in front. Here is my test code:
<body tal:define="grabbDefault string:menopause; grabbDefault2
string:diagnostik"
tal:attributes="onload python:'grabbDefault=%s;;grabbDefault2=%s;;'
% (grabbDefault, grabbDefault2)"
onload="">
Having your defines in the meta tag will not work. I thought maybe you
could declare them global but this failed as well. So it seems they must be
defined in the containing element, in this case the body tag right before
the tal:attributes for the onload attribute.
Enjoy,
--
Jeffrey D. Peterson
Webmaster & Resident Standards Warrior
"This too, shall pass."
> -----Original Message-----
> From: zpt-admin@zope.org [mailto:zpt-admin@zope.org]On Behalf Of Robert
> Rottermann
> Sent: Friday, January 18, 2002 10:15 AM
> To: zpt@zope.org
> Subject: [ZPT] How can I place a semicolon (;) in a tal string?
>
>
> Hi there,
> I try the following:
>
> in the header of a templatefile I define two string varaibles like so:
>
> <meta tal:define="grabbdefault string:'menopause';grabbdefault2
> string:'diagnostik';" tal:replace="nothing">
>
> in the bodytag I want to use it like so:
>
> <body tal:attributes="onload python:'grabbDefault=%s;grabbDefault2=%s;' %
> (grabbdefault, grabbdefault2)">
>
> When I try to save this, I get an error:
>
> <!-- Page Template Diagnostics
> Compilation failed
> TAL.TALDefs.TALError: Bad syntax in attributes:'grabbDefault2=%s'
> -->
>
> How can I circumvent that error??
> I know I can change the javascript code. Is there an other way?
>
> Robert
>
>
>
> _______________________________________________
> ZPT mailing list
> ZPT@zope.org
> http://lists.zope.org/mailman/listinfo/zpt
>