The page reloads the same SQLFORM edit form page with edited field not submited
On Thursday, April 19, 2018 at 12:33:46 AM UTC, Anthony wrote: > > On Wednesday, April 18, 2018 at 6:21:12 PM UTC-4, dirman wrote: >> >> Working after adding compute=lambda >> >> Field('link', compute=lambda r: r.article_link.replace(' ', '-')) >> > > Sorry, forgot the "compute=". I've updated my original response. > > >> However the table fields can not be updated using grid >> > > You can force the grid to include compute fields in forms by using the > "formargs" argument to pass the "fields" argument to the SQLFORM generated > by the grid: > > grid = SQLFORM.grid(..., formargs=dict(fields=['article_title', > 'article_link'])) > > When the grid generates the edit SQLFORM, it will pass the above "fields" > argument to SQLFORM, which will override the default field selection (which > excludes compute fields) and allow article_link to be edited. Note, if you > leave 'article_link' blank in a create or edit form, it will be entered as > an empty string in the database rather than computed. To avoid that with > create forms, you can instead limit 'article_link' to appear only in edit > forms by replacing "formargs" above with "editargs" (which only applies to > edit forms). > > Anthony > >> -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.