[Zope] Variablizing size parameter

Martijn Pieters mj@antraciet.nl
Thu, 27 May 1999 10:16:55 +0200


At 08:54 27/05/99 , Jay, Dylan wrote:
>I want to variablize the size parameter as I have done below
>
><TR>
>   <TD VALIGN="TOP">
>   <STRONG><!--#var fieldName--></STRONG>
>   </TD>
>   <TD VALIGN="TOP">
>   <i><!--#if "_.has_key(fieldID)"--><!--#var "_[fieldID]" size=fieldSize
>etc="..."--><!--#/if--></i>
>   </TD>
></TR>
>
>It seems however that I get the error "a size attribute was used in a var
>tag with a non-integer value.". So it appears to me that this can't be done.
>Is that so?

Is it a property on a DTML Document or Folder? If so, you can specify it as 
being a integer, instead of a string.

If the variable came from a form, you can add :int to the name on the form 
(filedID:int) so Zope will cast it to an integer. This will make the 
variable required, however.

You could also convert the variable to an integer on the spot, using 
_.string.atoi, like so (untested):

<!--#var "_[fieldID]" size="_.string.atoi(fieldSize)" etc="..."-->


--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| Tel: +31-35-6254545 Fax: +31-35-6254555
| mailto:mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
------------------------------------------