> form.element(_type='submit').update(_value='click me!')

Massimo, I just tried the above with t2.update using trunk (1.55rc1):

    form = t2.update(db.t2_person,query=
(db.t2_person.id==t2.person_id),next=nextpage,deletable=False)
    form.element(_type="submit").update(_value="Save")

The substitution of the button label works fine, but further down the
form something goes completely haywire. I get the form fields
splattered across my screen four or five times.

Looking at the generated html: after the closing </table> tag in the
form, after the <input name="id"...>, it should have <input
name="modified_on"...> but instead it starts afresh with <tr
id="t2_person_name_row">, ie, the top table row. I can send you both
html outputs if you like.

Cheers,
-Peter

On Dec 29, 3:21 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> 1) I am sorry. I do not understand without a code example.
>
> 2) not possible. I agree there should be a way to do it.
> Using the latest trunk you can do
>
> form.element(_type='submit').update(_value='click me!')
>
> Massimo
>
> On Dec 29, 5:21 am, Peter <peter.kleyn...@gmail.com> wrote:
>
> > 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
>
> > > On Dec 28, 3:42 pm, Peter <peter.kleyn...@gmail.com> wrote:
>
> > > > I need to display a form with images inline, ie with <img> tags. The
> > > > default behavior for SQLFORM is to only show a <file> link on the form
> > > > (assuming I provide a download URL in the constructor, which I do).
>
> > > > What's the best way to do this -- if at all? Again, I have difficulty
> > > > "breaking into" the SQLFORM object... Am I doomed to write my own
> > > > upload logic?
>
> > > > BTW, I would really appreciate a more formal API for SQLFORM that is
> > > > more geared towards using it piecemeal rather than the single
> > > > {{=form}}, which is suitable less than half of my current
> > > > application's forms. Ideally, any magic that SQLFORM provides should
> > > > be exposed in a lower-level API as well...
>
> > > > Note: I'm not a hardcore Pythonhead, more the type of "enterprise"
> > > > developer that I think Massimo seems to have had in mind when he
> > > > called web2py a "enterprise" framework. ;-) I thought I would be able
> > > > to get going quickly with SQLFORM and T2 CRUD, but so far, it's been a
> > > > bit of an uphill battle, I'm afraid... All the more frustrating
> > > > because I think it's very very close to what I need.
>
> > > > Cheers,
> > > > -Peter
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to