I have nothing against helpers as I use them a lot when involved with
a project to accomplish alone.
Working in team they are almost useless: the html code is usually the
source for your logic not a "product" to pass designers. You get html
static pages with style and putting in some logic is your business.
Seldom, at least in my everyday work you get the reverse.
>>designers can also use CODE, BEAUTIFY, .xml(), etc):
maybe in my dreams :-) They give you html and want back html to check.
Another issue is readability, the common "web2py mode" that I call
"everything in controllers" leads easily to monsters like this:
f2=FORM(FIELDSET(TAG.legend('COSTI JOB1',_id='daticosti'),\
TABLE(TR(TH('Lavoro/Materiale'),TH('UM'),TH('QT1/QT2/QT3'),TH
('Costo Un.'),TH('Totale')),\
TR(TD('Carta'),TD('Kg'),TD(SPAN(_id='carta_qt')),TD(SPAN
(_id='carta_cun')),\
TD(SPAN(_id='carta_tot'))),\
TR(TD('Lastre'),TD('Nr'),TD(SPAN(_id='lastre_qt')),TD(SPAN
(_id='lastre_cun')),\
TD(SPAN(_id='lastre_tot'))),\
TR(TD('Tiratura'),TD('min'),TD(SPAN(_id='tiratura_qt')),TD(SPAN
(_id='tiratura_cun')),\
TD(SPAN(_id='tiratura_tot'))),\
TR(TD('Avviamenti'),TD('min'),TD(SPAN(_id='avviam_qt')),TD(SPAN
(_id='avviam_cun')),\
TD(SPAN(_id='avviam_tot'))),\
TR(TD('Inchiostri'),TD('perc'),TD(SPAN(_id='ink_qt')),TD(SPAN
(_id='ink_cun')),\
TD(SPAN(_id='ink_tot'))),\
*[TR(rows_lavor[i]['descrizione'],db2(rows_lavor[i]
['idutilizzo_um']==
db2.um.id).select(db2.um.nome)[0].nome,\
TD(INPUT(_id='lav_qt'+str(rows_lavor[i]
['id']),_class='lavj1',_value='0',_name=str(rows_lavor[i]['id'])),\
INPUT(_id='lav_qt2'+str(rows_lavor[i]
['id']),_class='lavj1',_value='0',_name=str(rows_lavor[i]['id'])),\
INPUT(_id='lav_qt3'+str(rows_lavor[i]
['id']),_class='lavj1',_value='0',_name=str(rows_lavor[i]['id']))),\
' eur '+('%.2f')%(rows_lavor[i]['costo']),\
....more
But I would not like to diverge from the central point: is there a
"style" we can agree to be regarded as a good web2py manner to code
forms? A part from our helpers debate, there are people who simply do
not want to use them (Tim Farrell is one of them I think I remember):
can we simply give a clear direction to people like that? Farrell had
to make his method up.
Also not any form can be auto submitted (and forms.accepts is not
available): what about forms submitted with ajax get/post ( a style
increasingly popular) ? In this case it is useless even to keep the
form object in controller.
carlo