If this works it will be very usefull!!!!
Is there a way to modify myfunction so that it can be passed to onvalidate
or oncreate fields of SQLFORM.grid?
This is as close as I got but stiil get form validation error (value not in
database) on the referenced field: add_wiki() is my myfunction()
def add_wiki():
table=db[request.args(0)]
form=SQLFORM(table)
if request.post_vars._autocomplete_name_aux and not request.post_vars.
wiki_page_id:
request.post_vars.wiki_page_id=db.wiki_page.insert(slug=IS_SLUG()(
request.post_vars._autocomplete_name_aux))
return form.process()
def manage():
table=db[request.args(0)]
table.id.readable = table.id.writable = False
left=None
oncreate=None
if table.wiki_page_id:
left=db.wiki_page.on(db.wiki_page.id==table.wiki_page_id)
oncreate=add_wiki()
content=SQLFORM.grid(
table,left=left,
details=False,editable=True,deletable=False,create=True,
oncreate=oncreate,
args=request.args,
user_signature=False)
return dict(content=content)
Thank you. The SELECT_OR_ADD_OPTION never did work for me plus this will be
a more user friendly option!
Regards,
Bill
--