FormField
com.boldchat.visitor.api
Class FormField
- java.lang.Object
-
- com.boldchat.visitor.api.FormField
-
public class FormField extends java.lang.Object
Container class for information about an individual form field. This class also contains the value to be submitted.
-
-
Method Summary
Methods Modifier and Type Method and Description java.lang.String
getAdditionalHeading()
FormFieldOption
getDefaultOption()
java.lang.String
getKey()
java.lang.String
getLabel()
java.lang.String
getLabelBrandingKey()
java.util.List<FormFieldOption>
getOptions()
If the field isFormFieldType.Select
orFormFieldType.Radio
then this method returns all the options that should be given to the user.FormFieldType
getType()
java.lang.String
getValue()
boolean
isDepartmentStatusVisible()
If the field is typeFormFieldType.Select
and is a BoldChat department selection type of field then this field indicates if the online/offline status of the department should be shown to the user.boolean
isFloatToTop()
boolean
isMultiLine()
boolean
isRequired()
boolean
isVisible()
void
removeOption(FormFieldOption option)
Removes the option from the list of available options.void
setAdditionalHeading(java.lang.String additionalHeading)
void
setFloatToTop(boolean floatToTop)
Sets the field to float to the top of the form so it appears above the title.void
setValue(java.lang.String value)
void
setVisible(boolean isVisible)
-
-
-
Method Detail
-
getType
public FormFieldType getType()
- Returns:
- The type of the form field
-
getKey
public java.lang.String getKey()
- Returns:
- When submitting this is the key field that the server will be expecting.
-
isMultiLine
public boolean isMultiLine()
- Returns:
- If the text field is
FormFieldType.Text
then this field indicates if the text input field should have multiple lines.
-
getLabel
public java.lang.String getLabel()
- Returns:
- Gets the prompt label for the form field.
-
getLabelBrandingKey
public java.lang.String getLabelBrandingKey()
- Returns:
- Gets the branding value key that should be used for the label, or null if this is a custom field. If this retursn null then
getLabel()
should be used instead.
-
isRequired
public boolean isRequired()
- Returns:
- Indicates if there should be validation on this field to ensure the user enters information, or selects a value.
-
getOptions
public java.util.List<FormFieldOption> getOptions()
If the field isFormFieldType.Select
orFormFieldType.Radio
then this method returns all the options that should be given to the user.- Returns:
- The options for the selection or radio field.
-
isDepartmentStatusVisible
public boolean isDepartmentStatusVisible()
If the field is typeFormFieldType.Select
and is a BoldChat department selection type of field then this field indicates if the online/offline status of the department should be shown to the user.- Returns:
- True if the status should be shown, false otherwise
-
setValue
public void setValue(java.lang.String value)
- Parameters:
value
- The value for the form field to be submitted to the server.
-
getValue
public java.lang.String getValue()
- Returns:
- Gets the value that has been set for this field, or null if is unset.
-
getAdditionalHeading
public java.lang.String getAdditionalHeading()
- Returns:
- Gets an additional header that should appear above the form field.
-
getDefaultOption
public FormFieldOption getDefaultOption()
- Returns:
- If the field is type
FormFieldType.Select
this value is the option that should be selected by default.
-
isVisible
public boolean isVisible()
- Returns:
- Determines if the field should be shown to the user or not.
-
setVisible
public void setVisible(boolean isVisible)
- Parameters:
isVisible
- The visibility of this field for the user.
-
setAdditionalHeading
public void setAdditionalHeading(java.lang.String additionalHeading)
- Parameters:
additionalHeading
- This sets an additional header text on above the form field.
-
removeOption
public void removeOption(FormFieldOption option)
Removes the option from the list of available options.- Parameters:
option
- The option to remove.
-
setFloatToTop
public void setFloatToTop(boolean floatToTop)
Sets the field to float to the top of the form so it appears above the title.- Parameters:
floatToTop
- true if it should be at the top.
-
isFloatToTop
public boolean isFloatToTop()
- Returns:
- true if the field should be above the title of the form, false otherwise.
-
-