ENUM
HaapiModel.FormFieldFactory
Contents
- Methods
selectOption(label:value:selected:)
select(options:name:label:)
checkbox(checked:readonly:name:value:label:)
password(name:value:label:placeholder:)
username(name:value:label:placeholder:)
text(kind:name:value:label:placeholder:)
context(name:)
hidden(name:value:)
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:
- label: A label that describes the field.
- value: The value representation for the option.
- selected: The selection state of the field.
-
Returns: A built instance of
SelectFormField.Option
.
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:
- 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.
- options: An array of
-
Returns: A built instance of
SelectFormField
.
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:
- checked: The current
check
state of theCheckbox
field. - readonly: A bool value that dictates if the
checked
value is mutable. - name: The field name identifier.
- value: The representation of the value for the field.
- label: A label that describes the field.
- checked: The current
-
Returns: A built instance of
CheckboxFormField
.
Parameters
Name | Description |
---|---|
checked | The current check state of the Checkbox field. |
readonly | A bool value that dictates if the checked value 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: 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.
-
Returns: A built instance of
PasswordFormField
.
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: 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.
-
Returns: A built instance of
UsernameFormField
.
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:
- 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.
- kind: The
-
Returns: A built instance of
TextFormField
.
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: The field name identifier.
-
Returns: A built instance of
ContextFormField
.
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: The field name identifier.
- value: The representation of the value for the field.
-
Returns: A built instance of
HiddenFormField
.
Parameters
Name | Description |
---|---|
name | The field name identifier. |
value | The representation of the value for the field. |