The "action" attribute of the form is "#", which means the form will submit
to the URL of the parent page. Instead, your form must submit to the
edit_posts action, which means you need to trap the form submission and
submit it via Ajax as well. The easiest way to do this is to instead put
the form in a web2py component:
<button class="btn btn-lg" onclick="$.web2py.component('{{=URL('default' , '
edit_posts', args=post.id)}}', 'post_form');"> Edit </button>
<div id='post_form'></div>
Anthony
On Tuesday, June 10, 2014 2:06:32 AM UTC-4, Najtsirk wrote:
>
> Hi,
>
> in my default.py i have a simple function:
>
> def edit_posts():
> form=SQLFORM(db.postos, request.args(0)).process()
> return dict(form=form)
>
> On my posts page, i have a table of all posts with a button, that calls a
> SQLFORM with a jQuery load, like this:
>
> <button class="btn btn-lg"
> onclick="$('.content').load('{{=URL('default' , 'edit_posts',
> args=post.id)}}');">
> Edit </button>
>
> Until here, everything works ok. But the problem is, i canot update a post
> over this form.
>
> SQLFORM, whic is shown ad default/edit_posts/post.id works without
> problem.
>
> What am I missing here?
>
> Best,
> Kristjan
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.