Hello everyone,
I have a question regarding best practices with respect to SQLform and
custom widgets.
My forms require custom layouts to achieve look I am after. So far, to
accomplish this, I have used SQLform to handle the form processing
(brilliant, by the way) and then have done my form layout mostly by hand
and then inserting the specific widgets, e.g., {{=form.custom.widget.name}}
and so on.
For some of these I am setting id and class names in the controller to make
use of my own css styles and jquery plugins.
All works very well. Of course, the cost is that my forms will no longer
work quite right with the out-of-the-box web2py layouts. Not a big concern
for me as I have designed my own.
Recently I have been studying custom widgets and would like some feedback
from those more experienced with web2py, if I may.
Is is better practice to code custom widgets. For example, I really like
the anytime jquery plugin. To use it, I have overridden in the controller
the css class name and id for the datetime fields in my forms. And then
hooked them up to the anytime plugin with a short bit of javascript and
custom css classes.
But is it better to code a custom widget? I noticed in the deposit
directory that there was an anytime plugin widget (which I have not taken
too close a look at yet). Is it wiser to use a custom widget like that or
just proceed as I have? Pros/cons?
I just don't want to get too far along and discover I ought to have done
things differently.
Thanks in advance.
Cheers
Rod