Re: [web2py] Re: The Almighty Form

2017-04-26 Thread Carlos Costa
Great tip. I did something similar, but in views. I wrote a function to take a form and break it into a giver number of columns using bootstrap grid classes. The default stacked layout gets pretty boring with time. 2017-04-26 18:18 GMT-03:00 Alfonso Serra : > This is great i have found a way to

[web2py] Re: The Almighty Form

2017-04-26 Thread Alfonso Serra
This is great i have found a way to have full control on how a form is displayed and behave other than writing mystyle(form) in a view. This is how it would look like: def stylefrm(self): #create any custom header or form.custom.begin frm = FORM(_class="myform") #iterate over the

[web2py] Re: The Almighty Form

2015-12-18 Thread Anthony
On Friday, December 18, 2015 at 3:14:38 AM UTC-5, Alfonso Serra wrote: > > you should instead hide the errors, and then you could add your own via >> server-side DOM manipulation. >> > > But how do i do that if i dont know when errors has happened?. > After validation, if there are errors, then y

[web2py] Re: The Almighty Form

2015-12-18 Thread Alfonso Serra
> > you should instead hide the errors, and then you could add your own via > server-side DOM manipulation. > But how do i do that if i dont know when errors has happened?. Currently the form gets automatic markup when is instantiated and later on its modified when process is called. But this

[web2py] Re: The Almighty Form

2015-12-17 Thread Anthony
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

[web2py] Re: The Almighty Form

2015-12-17 Thread Alfonso Serra
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. And this is where the bootstrap decouple comes in place. Everything is easy if you use the welcome app

[web2py] Re: The Almighty Form

2015-12-17 Thread Anthony
If you really want to handle all of your HTML manually, don't bother using the web2py form object in the view at all. Just use SQLFORM for the server-side processing (i.e., validation and database inserts/updates). The only two requirements for the form HTML are that the "name" attributes of th

[web2py] Re: The Almighty Form

2015-12-17 Thread Alfonso Serra
Makes sense, but now i have automatic markup in my view when the form has errors, which is something that im trying to avoid. Any advise on how to disable that, so i can implement my own markup when that happens? Thanks -- Resources: - http://web2py.com - http://web2py.com/book (Documentation

[web2py] Re: The Almighty Form

2015-12-16 Thread Anthony
On Wednesday, December 16, 2015 at 5:09:51 PM UTC-5, Alfonso Serra wrote: > > I thought requires was performed in a different process than the form > serialization. It would be better if the requires information isnt embeded > in the inputs, but the form itself. > Wasnt expecting to redeclare req

[web2py] Re: The Almighty Form

2015-12-16 Thread Alfonso Serra
Thanks Niphlod and Anthony for your help. Niphlod i didnt want to use the tuple fields, was using form.fields to build everything from scratch as Anthony said. I like to have some kind of freedom to create html, without breaking internals whenever is posible. I thought requires was performed i

[web2py] Re: The Almighty Form

2015-12-16 Thread Anthony
On Wednesday, December 16, 2015 at 4:53:16 AM UTC-5, Alfonso Serra wrote: > > Im trying to create a formstyle, when the form is submitted without > introducing any value it skips any kind of validation and, without being > accepted, tries to perform db changes. Eventually i get an error ticket >

[web2py] Re: The Almighty Form

2015-12-16 Thread Niphlod
you're doing it wrong. "fields" is a tuple containing - usually - id, label, controls and help. On Wednesday, December 16, 2015 at 3:14:02 PM UTC+1, Alfonso Serra wrote: > > Ive found a workaround but the question still remains. Why cant we define > formstyles like the example above? > > the

[web2py] Re: The Almighty Form

2015-12-16 Thread Alfonso Serra
Ive found a workaround but the question still remains. Why cant we define formstyles like the example above? the workaround is by creating the formstyle like this: def mystyle(form): container = CAT() for fld in form.fields: container += INPUT(_name=fld) container += INPUT(_t