On Thu, Jan 27, 2011 at 3:27 AM, Bruno Rocha <[email protected]> wrote: > Thinking a bit more, taking the Vinicius comment and some examples of > another O.O frameworks. > I was wondering about... > #2 > auth.settings.formstyle = 'divs' > form = auth() > print form # return the HTML with divs
OK, but formstyle isn't related to auth in anyway, but it is to form, right? If auth wouldn't be showed (rendered) as a form, this property never needed to be used. > #3 > form = auth() > print form # should return the HTML with tables Yes, the default behaviour. :-) Let's go on. > ... > form.formstyle = 'divs' # sets the self.formstyle to 'divs' > and immediately raises a redraw method > #alternatively call explicitly the form.redraw() method > print form # should now return HTML with 'divs' > > I think Vinicius are talking about the case #3, which I think it is possible > to implement, but I don't know the caveats, Yes Bruno. You catched my mind. Actually, formstyle='divs' is a SQLFORM form property. It is the way print will show the generated HTML for this form instance. So, conceptually it is a form property. Your 3rd example show an intuitive method do implement this feature. I didn't have time to see the source code yet (I plan to do this tonight), but I see no reason to generate HTML code before the print call. -- Vinicius Assef.

