[Zope] Variablizing size parameter

Jay, Dylan djay@lucent.com
Fri, 28 May 1999 08:36:40 +1000


> -----Original Message-----
> From: Martijn Pieters [mailto:mj@antraciet.nl]
> Sent: Thursday, May 27, 1999 18:17
> To: Jay, Dylan; 'zope@zope.org'
> Subject: Re: [Zope] Variablizing size parameter
> 
> 
> 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="..."-->

Sorry, I should have specified. Its coming from a namspace ie

<!--#with "_.namespace(fieldSize=3)"-->

Which I'm presuming would keep fieldSize as an int?