wiki:DeveloperGuidelines/Popup

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(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 01_crud.py.

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.


DeveloperGuidelines

Last modified 13 years ago Last modified on 08/07/11 17:21:22
Note: See TracWiki for help on using the wiki.