Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Overview
Excerpt |
---|
This class lets you inspect the current form state as well as perform actions on it, such as adding handlers or updating values. |
The B25.Form class is the main point of interaction for anything that you want to do on the form. Inside the customize
method (defined in the B25.Form.Customizer
interface) you can add your own event handlers to the form (or its child elements). Inside the handleEvent
method of your own handlers, you can inspect the current form state and update values on it (or its child elements). Use the getter methods to access lower level child elements, such as fields or related lists.
Example 1: Adding a handler
Adding handlers is done inside the customize
method of your own implementation of the B25.Form.Customizer interface.
Also see: Quick Start Guide
Code Block |
---|
global with sharing class MyFormCustomizer implements B25.Form.Customizer { global void customize(B25.Form form) { form.getField(B25__Reservation__c.B25__Status__c).onUpdate(new MyStatusHandler()); } } |
Example 2: Updating the form
Updating the form is done inside the handleEvent
method of your own event handlers.
Also see: B25.FormEventHandler
Code Block |
---|
global with sharing class MyStatusHandler extends B25.FormEventHandler { global override void handleEvent(B25.FormEvent event, B25.Form form) { form.getField(B25__Reservation__c.B25__Title__c).updateValue('Hello World!'); } } |
Interfaces
B25.Form.Customizer
The B25.Form.Customizer interface is what you need to implement to attach your own handlers to the form (also see: Quick Start Guide). It only has one method, with the following signature:
Code Block |
---|
void customize(B25.Form form) |
Parameters:
Name | Type | Description |
---|---|---|
form | B25.Form | The form, to which you can add your own handlers. |
Methods
getField
Code Block |
---|
B25.FieldFormField getField(SObjectField fieldToken) |
This method will return a Field object for the specified SObjectField. The SObjectField must be an existing reservation field.
Parameters: SObjectField
Return value:B25.FormField
getLookup
Code Block |
---|
B25.Lookup getLookup(SObjectField fieldToken) |
Similar to getField, but instead this method will return a Lookup object for the specified SObjectField. The SObjectField must be an existing lookup field on reservation.
Parameters: SObjectField
getRelatedList
Code Block |
---|
B25.RelatedList getRelatedList(SObjectType sObjectToken) |
Returns the related list associated with the passed SObjectType.
Parameters: SObjectType
onInit (without parameters)
Code Block |
---|
List<B25.FormEventHandler> onInit() |
Returns a reference to the list of handlers that have been defined to trigger when the form is initialized. Because this method returns a reference to the actual list (and not a copy), any changes you make to this list will directly affect the defined handlers. This method is intended to be used in the customize method defined in your implementation of the B25.Form.Customizable interface. Using it anywhere else, such as inside one of your event handlers, will not have any effect.
Return value: List<B25 List<B25.FormEventHandler>FormEventHandler>
onInit (with parameter)
Code Block |
---|
void onInit(B25.FormEventHandler handler) |
Adds the given handler to the list of handlers that have been defined to trigger when the form is initialized. This method is a convenience method, and is identical to calling onInit().add(B25.FormEventHandler handler)
.
Parameters:
Name | Type | Description |
---|---|---|
handler | The handler to trigger when the form is initialized. |
On this page | |
---|---|
|