On Thursday, December 17, 2015 at 1:30:06 PM UTC-5, Alfonso Serra wrote:
>
> I thought about it but it has a disadvantage. The SQLFORM is perfect to 
> render complex queries without having to hardcode the html. If the models 
> changes i dont have to worry about the view.
>

You don't necessarily have to hard-code the HTML -- you could write your 
own abstraction that takes either a web2py FORM object or a DAL table model 
and generates the particular HTML you need for your forms. Once you have 
created this abstraction, you could re-use it for all forms.
 

> And this is where the bootstrap decouple comes in place. Everything is 
> easy if you use the welcome app as layout but for custom markup theres not 
> many examples on how to do things.
>

Just to be clear, nothing is coupled to Bootstrap (in fact, both FORM and 
SQLFORM pre-date Bootstrap). web2py provides several formstyles, including 
a couple that work specifically with Bootstrap. If you want to deviate from 
the built-in formstyles, yes, it will be more work, but that is 
unavoidable, as web2py cannot anticipate every possible way someone might 
want to structure the markup for a form. It's not reasonable to expect 
completely automatic UI generation in conjunction with customized UI 
requirements.
 

> If its not too much trouble i have another question:
>
> The form style isnt aware of form errors so i cannot "style" the form 
> properly. 
> When i print form.errors inside the style i get an empty storage even when 
> there are errors.
>
> Is there any particular way to achieve this, using formstyles?
>

Not directly with formstyles, as the formstyle is used to generate the form 
DOM *before* validation. The errors aren't added until the form object is 
serialized into HTML (i.e., when the .xml method is called). If you don't 
like the errors automatically added to the form, you should instead hide 
the errors, and then you could add your own via server-side DOM 
manipulation.

Anthony

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to