What error are you getting? Note, the onaccept argument has to be a function
(respons.js is just a string). Is that the source of your error?
On Sunday, June 12, 2011 7:28:18 AM UTC-4, 黄祥 wrote:
> your example is work fine on me, anthony, thank you so much, but when i
> tried to implement on my application it returns an error.
>
> e.g. 1.
> def __add_2(table_0, index_link, table_1, field):
> page = table_0(request.args(0)) or redirect(URL(index_link))
> response.js = 'web2py_component(action = "%s", target = "%s")' %
> (URL('blog_comment_show.load'), 'blog_comment_show')
> field.default = page.id
> form = crud.create(table_1, message = T('Record Inserted'), onaccept =
> response.js)
> return dict(page = page, form = form)
>
> e.g. 2.
> def __add_2(table_0, index_link, table_1, field):
> page = table_0(request.args(0)) or redirect(URL(index_link))
> field.default = page.id
> form = crud.create(table_1, message = T('Record Inserted'), onaccept
> = response.js = 'web2py_component(action = "%s", target = "%s")' %
> (URL('blog_comment_show.load'), 'blog_comment_show'))
> return dict(page = page, form = form)
>
> i'm new in python and web2py, so that i don't know how to implement this on
> my application, any idea about this problem? thank you so much.
>