Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

Excerpt

Represents a button on the form.

Buttons allow you to fire your own custom logic by defining a B25.FormEventHandler for them. You can add buttons inside your B25.Form.Customizer using the B25.Form.addButton method.

Example Customizer

Code Block
global with sharing class MyFormCustomizer implements B25.Form.Customizer {
    global void customize(B25.Form form) {
        form.addButton(new B25.FormButton('say-hello', 'Say Hello!')
	    .setClickHandler(new MyButtonHandler())
	);
    }
}

Example Handler

Code Block
global with sharing class MyButtonHandler extends B25.FormEventHandler {
    global override void handleEvent(B25.FormEvent event, B25.Form form) {
        form.getField(B25__Reservation__c.B25__Title__c).updateValue('Hello World!');
    }
}

Example Result

Image Modified

Constructors

FormButton(name, label)

Code Block
global B25.FormButton(String name, String label)

Creates a new FormButton with the given name and label. The name should be a unique value and is used internally to recognize the button. The label is the text on the button that is displayed to the user.

Parameters:

Name

Type

Description

name

String

A unique name for the button, not displayed to the user.

label

String

The text on the button, displayed to the user.

Methods

setClickHandler

Code Block
B25.FormButton setClickHandler(B25.FormEventHandler handler)

Sets a B25.FormEventHandler to fire when this button is clicked.

Return value: B25.FormButton

Parameters:

Name

Type

Description

handler

B25.FormEventHandler

The handler to be fired when the button is clicked.


setHideOnNewRecords

Code Block
B25.FormButton setHideOnNewRecords(Boolean value)

If this property is set to ‘true’, the button will not be visible on new records (so only on existing records). The default value is ‘false’.

Return value: B25.FormButton

Parameters:

Name

Type

Description

value

Boolean

The value that you want to set the property to.


setHideOnExistingRecords

Code Block
B25.FormButton setHideOnExistingRecords(Boolean value)

If this property is set to ‘true’, the button will not be visible on existing records (so only on new record). The default value is ‘false’.

Return value: B25.FormButton

Parameters:

Name

Type

Description

value

Boolean

The value that you want to set the property to.


setHideWhenEditing

Code Block
B25.FormButton setHideWhenEditing(Boolean value)

If this property is set to ‘true’, the button will not be visible when editing a record (so only when viewing a record). The default value is ‘false’.

Return value: B25.FormButton

Parameters:

Name

Type

Description

value

Boolean

The value that you want to set the property to.


setHideWhenViewing

Code Block
B25.FormButton setHideWhenViewing(Boolean value)

If this property is set to ‘true’, the button will not be visible when viewing a record (so only when editing a record). The default value is ‘false’.

Return value: B25.FormButton

Parameters:

Name

Type

Description

value

Boolean

The value that you want to set the property to.


setClosesForm

Code Block
B25.FormButton setClosesForm(Boolean value)

If this property is set to ‘true’, form will be closed when the button is clicked. The default value is ‘false’.

Return value: B25.FormButton

Parameters:

Name

Type

Description

value

Boolean

The value that you want to set the property to.


setConfirmationHeader

Code Block
B25.FormButton setConfirmationHeader(String value)

If this property is set, the button will display a confirmation dialog when the button is clicked, prompting the user to confirm before the button action is executed. This property controls the dialog header text. This property is not set by default.

Return value: B25.FormButton

Parameters:

Name

Type

Description

value

String

The header of the confirmation dialog to display.


setConfirmationBody

Code Block
B25.FormButton setConfirmationBody(String value)

If this property is set, the button will display a confirmation dialog when the button is clicked, prompting the user to confirm before the button action is executed. This property controls the dialog body text. This property is not set by default.

Return value: B25.FormButton

Parameters:

Name

Type

Description

value

String

The body of the confirmation dialog to display.


setConfirmationButtonLabel

Code Block
B25.FormButton setConfirmationButtonLabel(String value)

If this property is set, the button will display a confirmation dialog when the button is clicked, prompting the user to confirm before the button action is executed. This property controls the confirmation button label text. This property is not set by default.

Return value: B25.FormButton

Parameters:

Name

Type

Description

value

String

The label of the confirmation button.

On this page

Table of Contents