form is the form, form[0] is the table inside it. form[0][0] is the
first row. form[0][-1] is the last row, etc.
You can do

    form[0].append(TR('Label',TAG.button('whatever'),'comment'))

You can add more attributes to your TAG.button

On Oct 9, 8:39 pm, Jose de Oliveira Filho <[EMAIL PROTECTED]>
wrote:
> Thanks a bunch, Massimo. I completely overlooked the "hidden" thing  
> in the FORM source, but the first answer is what I was looking for.
>
> I need to add an extra button to a SQLFORM, like "Save and Add  
> another". I could put it outside the form but it looks really bad,  
> any recommendations here ?
>
> By the way, did you ever think of turning the SQLFORM generation into  
> divs instead of a table ?
>
> Thanks again,
>
> Deodoro Filho
>
> Em 09/10/2008, às 18:04, mdipierro escreveu:
>
>
>
> > Good questions. Answers below.
>
> >> (in controller:)
> >> def new_project():
> >>    f = FORM(INPUT(_name = "project_title", _type = "text"))
> >>    if f.accepts(request.vars, session):
> >>       db.project.insert(dict(title = f.vars.title, description =
> >> f.vars.description, user = session.user_id))
> >>       redirect(URL(r = request, f = "list"))
> >>    else:
> >>       return dict(form = f)
>
> >> My question is: is there some way of doing:
> >> ...db.insert.project(f.vars)...
> >> ?
>
> >> I'd be awesome if I could make "user" a hidden field directly.  
> >> That'd be like:
>
> >> ...f = SQLFORM(db.project, hidden = [db.project.user])
> >>    f.vars.user = session.user_id...
>
> >> and then remove the db.project.insert line.
>
> > There are many ways you can do it:
>
> > 1) the recommended way
>
> >      # list only the fields you want and pass the others directly to
> > the vars
> >      f=SQLFORM(db.project,fields=['title'])
> >      f.vars.user=session.user_id
>
> > 2) use a hidden field
>
> > f=SQLFORM(db.project,fields=['title'],hidden=dict
> > (user=session.user_id))
> >      #but now the visitor can tamper with the hidden field in the form
>
> > 3) Manually using
>
> >     ## vars has to be a dictionary (like form.vars) and must only
> > contain valid fields, not including id.
> >     vars=form.vars
> >     vars.user=session.user_id
> >     db.project.insert(**vars)
> >     ## the ** unpacks the dictionary into named arguments
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to