Hmm... doesn't seem to work.

Controller below.  As you can see, I've solved the puzzle to my
satisfaction, but I would like to know why the call to oncreate
misfires.

def handle_create(form):
    # never happens
    print 'hello, world'

def index():
    fields = [db.owner.name, db.dog.id]
    db.dog.represent = '%(name)s'

    # Just making sure we can detect a new owner request
    if len(request.args) > 2 and request.args[-1] == 'owner' and\
       request.args[-2] == 'new':
        print 'new one'

    form = SQLFORM.smartgrid(
        db.owner,
        ui = 'jquery-ui',
        deletable=False,
        oncreate = dict(owner=[handle_create]),
    )

    # this works
    # also how I have detected successful creates in the past
    if len(request.args) > 2 and request.args[-1] == 'owner' and\
       request.args[-2] == 'new' and form[2].process().accepted:
        print 'accepted it'



    return dict(form=form)


On Dec 22, 11:56 pm, Cliff <cjk...@gmail.com> wrote:
> Thanks.
>
> That's pretty close to what I was using, but I didn't have the syntax
> just right.
>
> Cliff Kachinske
>
> On Dec 22, 6:06 pm, Adi <adnan.smajlo...@gmail.com> wrote:
>
>
>
>
>
>
>
> > this is what i'm doing:
>
> > in a smartgrid use oncreate = dict(purchase_order=[po_oncreation]),
>
> > that takes you to your function after record is created, where you know the
> > id. The argument you use is form.
>
> > def po_oncreation(form):
> >     auth.archive
> >     last_id = form1.vars.id
> >     ...

Reply via email to