Got a little embarrassment here.

In an earlier post I wrote something incorrect, as follows:
   # even more
   # for those times when the grid default form isn't sufficient
   form = SQLFORM(db.sometable, .....)
   if form.accepts(...) #old method, I know
      yada
      yada
   return dict(form=form)

grid returns a div with the SQLFORM as the second element.  Therefore
the code should be:
    if form[1].accepts(...)
      yada
      blah

Sorry if I misled anyone.
On Nov 10, 10:52 am, Richard Vézina <[email protected]>
wrote:
> Hello Anthony,
>
> Are they flowing by the function where the SQLFORM.grid is calling or do I
> have to modify the grid class into sqlhtml.py?
>
> I naively try this that didn't work :
>
> def test_sqlformgrid():
>     table = SQLFORM.grid(db.TABLE, ui='jquery-ui',
> editable=auth.has_membership('reviewer'),
> deletable=auth.has_membership('reviewer'), formstyle = 'divs')
>     for i in range(0,len(form.create_form[0])):
>         if len(form[0][i][2][0]) > 0:
>             form[0][i][0].append(SPAN((helpicon(),
> SPAN(form[0][i][2][0])),_class='tooltip'))
>         del(form[0][i][2])
>     return dict(table=table)
>
> Thanks
>
> Richard
>
>
>
>
>
>
>
> On Thu, Nov 10, 2011 at 9:47 AM, Anthony <[email protected]> wrote:
> > On Wednesday, November 9, 2011 5:11:40 PM UTC-5, Richard wrote:
>
> >> Now I would like to know how I can intercept the html form before it get
> >> in the face of the user... I mean I use to do this hack to show user help
> >> bubble to the user :
>
> >> form = crud.create(db[request.args(0)**])
> >> for i in range(0,len(form[0])):
> >>                 if len(form[0][i][2][0]) > 0:
> >>                     form[0][i][0].append(SPAN((**helpicon(),
> >> SPAN(form[0][i][2][0])),_**class='tooltip'))
> >>                 del(form[0][i][2])
>
> >> So I would do the same with create, update form generated by SQLFORM.grid
>
> > In the create/update case, grid returns a div with the form as the second
> > component, and it looks like the form is also accessible via
> > form.create_form and form.edit_form, so I assume you should be able to use
> > some variation of the above to manipulate the form before returning it to
> > the view.
>
> > Anthony

Reply via email to