Just like on the server, you can either use the Model Form framework or implement your own custom form page.
Creating an Extensible Model Form Page
The Model Form framework allows pages to be extensible through its layout strategy. You can create an instance of
ModelFormStrategy to be used within your Model Form page, and then dependent modules can add fields and functionality to that
ModelFormStrategy instance. Here's an example:
this.getComponents is used to fetch components under a given key. In the example above, two keys have been defined: 'TABS' and 'FIELDS'. As we'll see in the next section, dependent modules can add components under these keys so they can be fetched inside
buildLayout and displayed in the model form page.
Because the keys for fetching components are defined by you, they should be documented so that dependent modules know how they can add components to your page. As seen in the example above, you can allow extra fields, tabs, or any other components anywhere in the page you want.
Extending a Model Form Page
Extension is done exclusively through the form strategy. ModelFormStrategy provides a few functions that enable a dependent module to add fields to the form, validate those fields, and set any errors that come back from the server.
Creating an Extensible Custom Form Page
The code for creating an extensible custom form is very similar to the model form example. The only difference is you create an instance of
FormStrategy, where there is no need to implement a
Because the keys for fetching components are defined by you, they should be documented so that dependent modules know how they can add components to your page.
Extending a Custom Form Page
Extending a custom form page is identical to extending a model form page; assuming the custom form properly implements the FormStrategy class, you can call the addX functions to add fields and validation to the page.