Using Dialogs on Forms
Forms can get very cluttered if there are lots of fields, sections, subgrids, and a klevr form or two on there.
Feature Overview
Forms can get very cluttered if there are lots of fields, sections, subgrids, and a klevr form or two on there. To help declutter the form, you have a few options. You could do a workflow-like form that steps the user through a few forms in a row with a newxt and previous button on each configured to jump between the various forms, or you could have a button open a dialog that shows a form with a specific section on it. This feature shows you how to use the "Open in Dialog" function from a custom button on a form.
Assumptions
- You have 2 (or more) forms configured for an entity, each with their own set of details on them.
- you want a button on the main form to open the secondary form in a dialog.
- Optionally, you want to run some javascript or reload the main form when the dialog is closed.
Design Details
This is using built-in functions provided by the portal for you.
Usage
To use the feature, add a new custom button to your form. Set the javascript to :
this.OpenDialog("<URL>", [OptionalJSCallbackFunction], "Dialog Title")
Replace <URL> with the URL for the page you wish to show in the dialog. The third parameter is the title of the dialog. The current record id and type will be passed on the querystring, in the refid and reftbl paramters. You can also provide your own querystring parameters, as well as pass {id} to be replaced with the current record id, as well as setting the title through a querystring parameter, for example:
this.OpenDialog("/portal-test2/?id={id}&title=Dialog Title")
The second parameter is optional, and you can specify the name of a custom javascript function that you have defined. if you don't specify it, the dialog will close and the main page will remain open as is. If you specify your own function, it will be called once the dialog is closed, and it will expect the function to either return true or false. If the function returns true, the main page will be submitted and permorm the button function as per the button configuration for this button (e.g. save, cancel, redirect). If it returns false, it is like a custom javascript function that cancels the form submit process and keeps the form open as is.
Security Considerations
There are no specific security considerations. Ensure that the user has access to the main and sub forms, as well as table permissions to the entity used by the forms.
Last updated on