Version 3 (modified by Fran Boon, 13 years ago) ( diff )

Discuss use of 'child' var

Popups for Form reference data

When adding items, the opened window should be a popup, Submit should close that window & pre-populate the main form with the result.

We use Progressive Enhancement to allow non-Javascript browsers to access via a new tab (with manual refresh of parent window & then manual selection of new item).

Model should include a comment like this:

db.table.field.comment = A(T("Add Contact"), _class="colorbox", _href=URL(r=request, c="pr", f="person", args="create", vars=dict(format="popup")), _target="top"))

We use jQuery to catch the click for the class=colorbox (in static/scripts/S3/S3.js).

There is a special format=popup added to the CRUD controller in

This uses it's own view: views/popup.html, the intelligence for which is in views/layout_popup.html.

Refresh of the calling dropdown is handled via the 'caller' var (which is added automatically).
This works automatically for reusable fields such as 'location_id', however if creating additional fields in your table with alternate names, then also need to pass a 'child' variable (in the vars dict in your .comment) which refers to the fieldname that needs refreshing.


Note: See TracWiki for help on using the wiki.