How To open an item's form in a frame |
This topic explains how to open an item's form using a frame, embedded in the same browser tab.
Web pages are generally opened using a new or the same tab.
Packflow offers a third way: opening the page without leaving the current tab and user context.
This possibility have great advantages: avoid to overburden the user with many tabs, keeping its context when leaving the form (page number, filters, orders) and better synchronization with the parent page.
This feature can be used in the navigation (via a dedicated site setting), or in controls and gridviews (via model options).
You can open such a frame using a Javascript function named PF_OpenFrame.
It only requires the URL of an item's form. Note that you can pass the URL for a new item, just replace the id with the "New" keyword.
Two optional callbacks are also available and will be called when the form is loaded and when the frame is closed by the user.
To illustrate its use, here is how it has been implemented in our gridviews:
var initialVersionNumber = -1; PF_OpenFrame(url, function (applicationId, contentTypeId, itemId, versionNumber) { //Form closed if (versionNumber > initialVersionNumber) { console.log('Reload row'); PFGridView_ReloadRow($(targetRow)); } else console.log('Row not refreshed: ' + initialVersionNumber + '=' + versionNumber); }, function (applicationId, contentTypeId, itemId, isFirstLoad, versionNumber) { //Form loaded if (isFirstLoad) { initialVersionNumber = versionNumber; console.log('Initial modal version: ' + initialVersionNumber); } });