Thank you -- based on all of your input I'm having another stab at
using T2.
Two more questions:
- How do you pass variables to T2-enabled pages without breaking T2
behaviors? For instance, I have a page where person X buys product P;
prod_id is passed as a var or an arg in the query string. The T2 form
shows person X's details, including an inline image (very nice ;-)),
but the #zoom anchor doesn't work because the prod_id in the URL gets
in the way. What's the best practice here?? I can sneak prod_id into
the session vars, but that doesn't seem very RESTful -- apart from it
being a pain not being able to embed the prod_id in a link...
- Call me stupid, I can't find the way to rename the submit button on
T2 update/create forms? I know you can do this with submit_button= in
SQLFORM, but this doesn't seem to get passed into T2 forms. The only
way is to manipulate the components[..] stuff -- eg, through the new
elements interface?
Cheers again...
-Peter
On Dec 29, 7:10 am, mdipierro <
mdipie...@cs.depaul.edu> wrote:
> define a widget, something like:
>
> def myhelper(field,value):
> field_id='%s_%s' % (field._tablename,
field.name)
> inp=INPUT(_type='file',_id=field_id,_class=field.type,
> _name=
field.name, requires=field.requires)
> if not value: return inp
> url='app/controller/download/'+value ###### edit this line
> return DIV(inp,IMG(_src=url,_width=200),
> INPUT(_type='checkbox',_name=
field.name
> +'__delete'),'delete]')
>
> tell web2py that the field should be represented by the widget.
>
> works with sqlform, t2 and t3.
>
> Massimo
>
> db.yourtable.yourfield.represent=myhelper