I usually make my customization of the form errors trough the controller.

For example in your case I would do:
   
 form = SQLFORM(db.mytable,formstyle = 'divs')
    if form.process().accepted:
       response.flash = 'form accepted'
    elif form.errors:
       for fieldname in form.errors:
           control = form.element(_name=fieldname)
           control.parent.append(DIV(DIV(form.errors[fieldname],_class=
"error",_style="display:inline-block;")))
       form.errors.clear()
       response.flash = 'form has errors'
    else:
       response.flash = 'please fill out the form'

I hope this helps.

Il giorno giovedì 21 giugno 2012 21:11:51 UTC+2, Richard ha scritto:
>
> I think the actual implementation works ok with anything but 'divs' form 
> style (to be confirmed).
>
> I use divs style in my app and the error message box goes right trougth 
> the right even if the error message is only one word.
>
> Richard
>
> On Thu, Jun 21, 2012 at 2:51 PM, RKS <[email protected]> wrote:
>
>> An inline-block has auto-width and will stretch to fit the error message. 
>> I don't see why you need the extra div wrapper. You could also change your 
>> error message to be inline.
>>
>>
>> On Friday, March 2, 2012 11:00:11 AM UTC-6, Richard wrote:
>>>
>>> Hello,
>>>
>>> Could we consider this change :
>>>
>>> Wrapping error div inside an other div?
>>>
>>> Reason :
>>>
>>> Allow auto width of error box base on length of error message.
>>>
>>> Try this with chrome dev tool on a triggered validator page :
>>>
>>> <div style="block;"> <!-- error box wrapper --> <div class="error" 
>>> id="myfield__error" style="display: inline-block; ">field can't be 
>>> empty</div> <!-- change to the actual error box : style="display: 
>>> inline-block; " --> </div>
>>>
>>> I think it will work every where 3cols 2cols and divs... I try it with 3 
>>> cols and divs.
>>>
>>> Thanks
>>>
>>> Richard
>>>
>>  -- 
>>
>
>

-- 



Reply via email to