Hi Massimo,

I have a similar problem, and will deploy to gae

I want to do a crud.create form on table1.dollars and then when it is
accepted, automatically update table2.total with a running total

How do I do this?

Here's what I did but it just accepts the form data, inserts to table
1 then doesn't redirect and doesn't update table 2, i just remain at
the form view with the values blanked out

def personal_loan_commit():
    loans_id = request.args(0)
    db.commitments.lender_id.default = user_id
    db.commitments.loan_id.default = loans_id
    form = crud.create(db.commitments,next=URL
(r=request,f='personal_loans_listed',args=loans_id),message='Loan
Commitment Made')
    if form.accepts(request.vars, session):
        db(db.loans.id == loans_id).update(lender_members_committed =
db.loans.lender_members_committed  +
1,lender_committed_amount=db.loans.lender_committed_amount +
request.vars.committed_amount)
    loan = dict(id=request.args(0), title=request.args(1))
    return dict (form=form,loan=loan)


Also, I saw you mention that certain syntax wont work on GAE, which
matches the syntax i have right after the form accepts line.  What
should that change to as well?

On Sep 26, 4:31 pm, mdipierro <[email protected]> wrote:
> not sure I understand. perhaps this:
>
> max_id=db(db.table.questionary_id==1).select
> (db.table.question_number,orderby=~db.question.number,limitby=
> (0,1)).first().question_number
>
> db.table.question_number.default=max_id+1
> db.table.question_number.writable=False
> form=crud.create(db.table)
>
> On Sep 26, 6:01 pm, ProfessionalIT <[email protected]> wrote:
>
>
>
> > mdipierro,
>
> >    But, how to get this value in a createcrudform ?
>
> >    Two questions, that can resolve my problem:
>
> >    1) The createcrudmethod has a "pre-action" where I can manipulate
> > this value ?
> >         If yes:
> >              2) How to set this value in a form generated by a
> >crud.create method ?
>
> >     My main problem is: I have that show this "incremented value" in a
> > create form. This is my problem !.- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected]
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