ENUM

HaapiModel.FormFieldFactory

Contents

enum FormFieldFactory

Provides functionality to build instances of FormField.

Methods

selectOption(label:value:selected:)

public static func selectOption(label: Message,
                                value: String,
                                selected: Bool) -> SelectFormField.Option

Creates an instance of SelectFormField.Option model.

Parameters

Name Description
label A label that describes the field.
value The value representation for the option.
selected The selection state of the field.

select(options:name:label:)

public static func select(options: [SelectFormField.Option],
                          name: String,
                          label: Message?) -> SelectFormField

Creates an instance of SelectFormField model.

Parameters

Name Description
options An array of SelectFormField.Option that represents the available options to choose from.
name The field name identifier.
label A label that describes the field.

checkbox(checked:readonly:name:value:label:)

public static func checkbox(checked: Bool,
                            readonly: Bool,
                            name: String,
                            value: String?,
                            label: Message?) -> CheckboxFormField

Creates an instance of CheckboxFormField model.

Parameters

Name Description
checked The current check state of the Checkbox field.
readonly A bool value that dictates if the checkedvalue is mutable.
name The field name identifier.
value The representation of the value for the field.
label A label that describes the field.

password(name:value:label:placeholder:)

public static func password(name: String,
                            value: String?,
                            label: Message?,
                            placeholder: Message?) -> PasswordFormField

Creates an instance of PasswordFormField model.

Parameters

Name Description
name The field name identifier.
value The field’s current value.
label A label that describes the field.
placeholder A label that describes a possible hint for the field.

username(name:value:label:placeholder:)

public static func username(name: String,
                            value: String?,
                            label: Message?,
                            placeholder: Message?) -> UsernameFormField

Creates an instance of UsernameFormField model.

Parameters

Name Description
name The field name identifier.
value The field’s current value.
label A label that describes the field.
placeholder A label that describes a possible hint for the field.

text(kind:name:value:label:placeholder:)

public static func text(kind: TextFormField.Kind?,
                        name: String,
                        value: String?,
                        label: Message?,
                        placeholder: Message?) -> TextFormField

Creates an instance of TextFormField model.

Parameters

Name Description
kind The TextFormField.Kind value for the represented field.
name The field name identifier.
value The field’s current value.
label A label that describes the field.
placeholder A label that describes a possible hint for the field.

context(name:)

public static func context(name: String) -> ContextFormField

Creates an instance of ContextFormField model.

Parameters

Name Description
name The field name identifier.

hidden(name:value:)

public static func hidden(name: String, value: String) -> HiddenFormField

Creates an instance of HiddenFormField model.

Parameters

Name Description
name The field name identifier.
value The representation of the value for the field.