Sorry to be pain keep asking loads of what probably seems like dumb
questions but.....


Given this section of my controller, you will see that in view_post(), I am
calling comment_form() to generate a form and return it back so I can
include it in the view_post.html. The form displays fine in the view but
the when I view the source the action ="" so it does not post anywhere.
What am I doing wrong?


def view_post():
    post = get_post(request.args(0))
    comments=get_comments(request.args(0))
    commentform = comment_form(request.args(0))
    return dict(post=post[0],commentform=commentform,comments=comments)

def get_post(id):
    return db(db.post.id==id).select(db.post.ALL)


def comment_form(post_id):
    db.comments.post_id.default = post_id
    form = SQLFORM(db.comments)
    if form.process().accepted:
        response.flash = "Comment saved"
        view_post(form.vars.post_id)
    return form

def get_comments(post_id):
    comments =
db(db.comments.post_id==post_id).select(orderby=~db.comments.date_created)
    return comments

Thanks
Simon

-- 



Reply via email to