Hi all,
I recently had to deal with a very similar situation to:
http://groups.google.com/group/web2py/browse_thread/thread/ad5a9494c4bb06fb/f88a913ee7514197?lnk=gst&q=custom+forms#f88a913ee7514197
----------------------------------
The original message:
I still seem to be missing something. Must be obvious but I can't see
it.
I use the example code you showed, and the errors dict shows the
values and
form.errors is now an empty dict, but the error messages still get
displayed
in the old manner without me doing anything. It's as if the error
messages
are displayed from somewhere else, but I can't see where.
I put this line of code towards the top of my view:--
{{(errors,form.errors)=(form.errors,dict())}}
Then I display errors and form.errors to make sure they have what I
expect.
Form.errors is empty. Now I would expect not to see any errror
messages
unless I place them myself. Unfortunately, they still appear in the
old
position as though I had made no changes.
What have I overlooked.
John Aherne
----------------------------------
After some poking around, I found the bit of code that renders the
error message, even on custom controls.
You can disable the error message attached to individual controls by
writing the following code:
{{form.custom.widget.name_of_widget['hideerror'] = True}}
If you want to remove all the error messages without prejudice, you
can do the following:
for widget in form.custom.widget:
try:
form.custom.widget[widget]['hideerror'] = True
except:
pass
I believe there's a setting to do this globally (crud.hide_errors or
something?) but I haven't needed it yet. If someone needs it I'd be
happy to point them in the right direction.
Unfortunately I'm a year past the original message, but perhaps this
will be useful to someone.