Why are not form buttons styled automatically by the CSS?

On Sunday, 2 September 2012 00:53:41 UTC-5, Annet wrote:
>
> In a controller I have the following function:
>
> def subCreate():
>     form=SQLFORM.factory(
>     
> Field('subClass',type='integer',requires=IS_IN_SET([1,2,3],labels=['Organization','Person','Connector'],zero=T('select
>  
> a value'))),
>     separator='')
>     if form.process(keepvalues=False).accepted:
>         ....
>     elif form.errors:
>         response.flash=response.flash_formerror
>     else:
>         response.flash=response.flash_form
>     return dict(form=form)
>
> When I display the form, the buttons aren't styled as Bootstrap buttons, 
> because they have no class 'btn'
>
> I wrote this function, but calling it in every function that contains a 
> form isn't the way to go I think:
>
> def addFormClasses(form):
>     form.element('label')['_class']='control-label'
>     if form.element(_type='submit'):
>         form.element(_type='submit')['_class']='btn btn-primary'
>     if form.element(_type='button'):
>         form.element(_type='button')['_class']='btn'
>     if form.element(_type='reset'):
>         form.element(_type='reset')['_class']='btn'
>     return None
>
>
> Kind regards,
>
> Annet
>

-- 



Reply via email to