If you want to add the error message within the form, you could do 
something like:

form.elements('input[name=myfield]',
              replace=lambda input: DIV(input, error_message_element, _class
='error_wrapper'))

Anthony

On Tuesday, April 14, 2015 at 12:10:03 PM UTC-4, mweissen wrote:
>
> Ok, let's try CSS.
> My idea was to learn more about form.elements
>
> What would be the best way to add a special error message?
>
> Thank you, Martin
>
> 2015-04-14 17:39 GMT+02:00 Anthony <[email protected]>:
>
>> You can also suppress the default error display and add your own.
>>
>>
>> On Tuesday, April 14, 2015 at 11:39:06 AM UTC-4, Anthony wrote:
>>>
>>> The error_wrapper div is added when the form is serialized into HTML, so 
>>> it is not in the DOM at that point. Can you just use CSS to handle the 
>>> formatting you need?
>>>
>>> Anthony
>>>
>>> On Tuesday, April 14, 2015 at 8:31:41 AM UTC-4, mweissen wrote:
>>>>
>>>> What I want to do:
>>>> I need an "error_wrapper", which takes 90% of the width of the form.
>>>>
>>>> Parts of my code:
>>>>
>>>> if form.process(onvalidation=extracheck).accepted:
>>>>    ... works as expected ....
>>>>
>>>> def extracheck(form):
>>>>    # some actions ... works as expected ....
>>>>    print form.elements('div', _class="error_wrapper")
>>>>    print form.elements('.error_wrapper')
>>>>    # and some other variants
>>>>
>>>> All lists are empty - what is wrong?
>>>> Regards, Martin
>>>>
>>>>
>>>>
>>>>
>>>>  
>
>  

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to