Something like this...
SQLFORM(...., hidden=dict('post_id'='999'))
Hope that is what you meant.
On Monday, August 20, 2012 9:23:47 PM UTC+1, Simon Carr wrote:
>
> I am still writing my learning application a Blog. I have now created a
> function in my controller to produce a form for users to leave comments for
> a post.
>
> How do I add a hidden field to the comment form with the post_id? here is
> my database defs if it helps.
>
>
> db.define_table(
> 'post',
> Field('author',db.auth_user),
> Field('date_created','datetime',default=request.now),
> Field('title',requires=IS_NOT_EMPTY()),
> Field('body','text',requires=IS_NOT_EMPTY()),
> format='%(title)s')
>
> db.define_table(
> 'comments',
> Field('post_id',db.post),
> Field('author',db.auth_user),
> Field('date_created','datetime',default=request.now),
> Field('title',requires=IS_NOT_EMPTY),
> Field('comment','text',requires=IS_NOT_EMPTY()),
> format='%(title)s')
>
>
>
> Thanks
> Simon
>
--