On Wednesday, April 13, 2011 5:37:13 AM UTC-4, Anthony wrote:
>
> On Wednesday, April 13, 2011 2:47:24 AM UTC-4, niknok wrote:
>>
>> The method:
>> form=DIV(SPAN(T('Instruction text above the form')), form)
>>
>> didn't work. I get an error:
>> AttributeError: 'DIV' object has no attribute 'accepts'
>>
>> If I take it out, everything works as usual.
>>
>
> Yes, once you wrap the form in a DIV, it becomes a DIV object instead of a
> FORM object, so the accepts() method won't work on it. So, you should do one
> of the following:
>
> - Add the DIV *after* you call form.accepts in your controller.
> - Name the DIV something other than 'form' (e.g., 'formdiv').
> - Extract the form from the DIV before calling accepts() -- i.e.,
> form.element('form').accepts(...)
>
> Of course, you're probably better off just adding the DIV in the view (you
can pass the instruction message from the controller as a separate item in
the dict).
Anthony