I am obviously thick. ;-) I want to do a simple calculation in a dtml tag and print the result: <dtml-var expr="85 * HowOften"> HowOften is a value that has been set by an HTML input in a web form. When I run this with a value of 3 for the result is that it prints the character 3 85 times! So it treats it as a string. Obviously I need to convert HowOften to a float, but how do I do it? Cheers Marc
Marc Burgauer wrote:
I am obviously thick. ;-)
I want to do a simple calculation in a dtml tag and print the result:
<dtml-var expr="85 * HowOften">
HowOften is a value that has been set by an HTML input in a web form. When I run this with a value of 3 for the result is that it prints the character 3 85 times! So it treats it as a string.
Obviously I need to convert HowOften to a float, but how do I do it?
Two possible ways: You can "marshall" the html-input-text with: <input type="text" name="HowOften:float"> in your web-form or you can convert it in your result-page with: <dtml-var "85 * _.float(HowOften)"> -mj -- German Zope User Group (DZUG) - http://www.dzug.org/
Hi try this <dtml-var expr="85 * _.float(HowOften)"> rgds
I am obviously thick. ;-)
I want to do a simple calculation in a dtml tag and print the result:
<dtml-var expr="85 * HowOften">
HowOften is a value that has been set by an HTML input in a web form. When I run this with a value of 3 for the result is that it prints the character 3 85 times! So it treats it as a string.
Obviously I need to convert HowOften to a float, but how do I do it?
Cheers
Marc
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
participants (3)
-
Dragos Chirila -
Maik Jablonski -
Marc Burgauer