Instead of
form=crud.update(db.property_detail, request.args(1)
,deletable=True
,next='property_detail_index.load/property_id/[id]'
)
you can do
form=crud.update(db.property_detail, request.args(1)
,deletable=True
)
if form.accepted:
redirect(URL('property_detail_index.load',args=('property_id',form.vars.id)))
form.vars.id is what you are looking for.
On Nov 2, 4:26 pm, Philip Kilner <[email protected]> wrote:
> Hi Massimo,
>
> On 02/11/2011 20:12, Massimo Di Pierro wrote:
>
> > Can you show us your code? which web2py version?
>
> Sure, and I'm on 1.99.2.
>
> Interestingly, in my efforts to reproduce this I've figured out when it
> works and when not.
>
> This fails: -
>
> def property_detail_update():
> crud.settings.showid = True
> crud.messages.submit_button = 'Update Property Detail'
> form=crud.update(db.property_detail, request.args(1)
> ,deletable=True
> ,next='/landlord/property_detail_index.load/property_id/[id]'
> )
> return dict(form=form)
>
> ...and Firebug tells me: -
>
> "NetworkError: 400 BAD REQUEST
> -https://s4a.w2p.xfr.co.uk/landlord/property_detail_index.load/propert..."
>
> ...but I made two mistakes in my problem report. The first was not to
> realise that it is /Firebug/ that's showing me that encoding, but in
> reality all web2py is doing is passing along "[id]" unmodified. The
> second, and most important, was that I was explicitly calling the
> controller and adding a leading slash. If I remove "/landlord/" from the
> above it works fine.
>
> I'm still curious as to whether I can access the ID value in the
> controller with an expression, rather than having my string substituted,
> though!
>
> --
>
> Regards,
>
> PhilK
>
> 'a bell is a cup...until it is struck'