Etienne Desgagné wrote:
Hi everyone,
I need to buid a javascript array of this form:
var theArray = new Array("123|Beth","543|John","234|Ben","43|Leia","76|Steven","45|Rebecca","7686|Travis","3456|Kirk");
but by using TAL in a ZPT. The values come from a ZSQL method. It could look like this:
var theArray = new Array( <span tal:repeat="array_elt container/reqZSQL3" tal:omit-tag=""> <span tal:replace="array_elt">1</span><span tal:condition="not:repeat/array_elt/end" tal:omit-tag="">, </span> </span>);
but this is not working. (the ZSQL method contain the two columns of value)
Someone have an idea?
I think you should access the two columns of return values individually, like: <span tal:replace='string:"${array_elt/id}|${array_elt/name}"' /> assuming the names of your two columns are id and name. By the way, the <tal> tag will not be executed within <script> tags. So you may have to use python script to generate your javascript code. -- HONG Yuan Homemaster Trading Co., Ltd. No. 601, Bldg. 41, 288 Shuangyang Rd. (N) Shanghai 200433, P.R.C. Tel: +86 21 55056553 Fax: +86 21 55067325 E-mail: hongyuan@homemaster.cn