At this time using [i], .element, .append and .insert are the only
methods to manipulate the form. Can you provide an example of the API
you would like to have?

Massimo

On Jan 18, 2:54 pm, Peter <peter.kleyn...@gmail.com> wrote:
> Hi Massimo et al,
>
> First of all, the onvalidation callback that is now in SQLFORM (in
> trunk) is a real winner, thanks! The validation rules in my app are
> largely context-sensitive, and that was a big problem -- until now.
>
> I am still struggling to find the best way to customize SQLFORM views,
> though. The "new" form.element() function only allows me to modify the
> attributes existing xml nodes -- is that correct?
>
> For instance, I needed previous/next buttons in a multi-page form, and
> I really hate having to handcode entire forms in the html (or in the
> controller, for that matter). This is what I came up with:
>
> # controller
>    form=SQLFORM(db.t2_person,myperson,deletable=False,showid=False)
>
>     l = len(form.components[0])  # =number of rows in form
>
>     # add input element to second td in submit row
>     form.components[0][l-1][1].append( INPUT(_type="buttonx") )
>
>     # redefine both "submit" and "buttonx"
>     form.element(_type="submit").update(_type="button",
>         _value="<<Previous",_onclick="location='"+URL
> (r=request,f='step1')+"';")
>     form.element(_type="buttonx").update(_type="submit",
> _value="Next>>")
>
> Basically, I add a new 'dummy'  input element and then redefine both
> inputs using form.element(). This works, but the direct use of the
> internal form/div structure to insert a new xml node is an eyesore. Is
> there a better way to do this?
>
> Ideally, I'd be looking for a sort of formalized API that I could use
> to manipulate the entire xml tree of the form, eg, similar to the
> DOM.
>
> 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