I have a form that is used to insert some records to a database, and one
of the fields is a sequence number. I want to increment this number when
the form is used, unless is the first time it is loaded.

The form (idea copied from the SmartForms HOWTO) have the name
"Register", and is something like this:

<dtml-var standard_html_header>

  Record inserted.

<dtml-if my_number>
  <dtml-call "REQUEST.set('my_number', my_number + 1)">
  <dtml-call "REQUEST.set('my_number', 1)">

<form action="Register" method="POST">
A Field <input name="my_field" value="some value"><br>
A Number <input name="my_number" value="<dtml-var my_number>"><br>
<input type="submit" value="OK">

<dtml-var standard_html_footer>

It work for the first load, but when I press the OK button, I get an
error message:

Error Type: TypeError
Error Value: illegal argument type for built-in operation

The traceback:

Traceback (innermost last):
  File /usr/lib/python1.5/site-packages/ZPublisher/Publish.py, line 222,
in publish_module
  File /usr/lib/python1.5/site-packages/ZPublisher/Publish.py, line 187,
in publish
  File /usr/share/zope/lib/python/Zope/__init__.py, line 221, in
    (Object: Traversable)
  File /usr/lib/python1.5/site-packages/ZPublisher/Publish.py, line 171,
in publish
  File /usr/lib/python1.5/site-packages/ZPublisher/mapply.py, line 160,
in mapply
    (Object: Register)
  File /usr/lib/python1.5/site-packages/ZPublisher/Publish.py, line 112,
in call_object
    (Object: Register)
  File /usr/share/zope/lib/python/OFS/DTMLMethod.py, line 172, in
    (Object: Register)
  File /usr/lib/python1.5/site-packages/DocumentTemplate/DT_String.py,
line 528, in __call__
    (Object: Register)
  File /usr/lib/python1.5/site-packages/DocumentTemplate/DT_Util.py,
line 342, in eval
    (Object: REQUEST.set('my_number', my_number + 1))
    (Info: REQUEST)
  File <string>, line 0, in ?
TypeError: (see above)


What is wrong? How do I increment the value?

 | César A. K. Grossmann           | Capacitação Solidária           |
 | [EMAIL PROTECTED]            | http://www.uol.com.br/umminuto/ |
 | http://members.xoom.com/ckant/  | Clique e doe - é de graça       |
  A ética do iG: http://antispambr.abranetrj.org.br/not-20001023.html

One Bell System - it used to work before they installed the Dimension!

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to