Class FormDef.Input
java.lang.Object
org.apache.juneau.console.widgets.FormDef.Input
- Enclosing class:
- FormDef
@BeanType(properties="name,label,type,required,value,options,pattern,maxLength,help,actionId")
public static class FormDef.Input
extends Object
A single typed form input painted client-side with
createElement (never innerHTML).- Since:
- 10.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA singleselectoption: a submit value and its visible label. -
Field Summary
FieldsModifier and TypeFieldDescriptionThe enclosing view's row-action id anactionbutton opens; omitted from the wire otherwise.An optional help hint painted withtextContent; omitted from the wire otherwise.The label shown next to the control.An optional client max-length fortext/textarea; omitted from the wire otherwise.The submit-body key for this field (e.g.The options for aselectfield, in display order; omitted from the wire otherwise.An optional client validation regexp fortext/textarea; omitted from the wire otherwise.WhenBoolean.TRUE, the control is required.One oftext,textarea,password,checkbox,toggle,select,action.Optional prefill, applied via.value/.checked(neverinnerHTML). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSets the enclosing view's row-action id thisactionbutton opens.Sets the help hint (painted withtextContent).maxLength(int value) Sets the client max-length (text/textareaonly).static FormDef.InputCreates a typed form input.Adds oneselectoption.options(FormDef.Input.Option... value) Sets theselectoptions (replacing any existing).Sets the client validation regexp (text/textareaonly).required()Marks this input required.required(boolean value) Sets whether this input is required.Sets the optional prefill.
-
Field Details
-
name
The submit-body key for this field (e.g.resolution). -
label
The label shown next to the control. -
type
One oftext,textarea,password,checkbox,toggle,select,action. -
required
WhenBoolean.TRUE, the control is required. Omitted from the wire otherwise. -
value
Optional prefill, applied via.value/.checked(neverinnerHTML). -
options
The options for aselectfield, in display order; omitted from the wire otherwise. -
pattern
An optional client validation regexp fortext/textarea; omitted from the wire otherwise. -
maxLength
An optional client max-length fortext/textarea; omitted from the wire otherwise. -
help
An optional help hint painted withtextContent; omitted from the wire otherwise. -
actionId
The enclosing view's row-action id anactionbutton opens; omitted from the wire otherwise. SeeActionReffor the typed reference the builder accepts.
-
-
Constructor Details
-
Input
public Input()
-
-
Method Details
-
of
Creates a typed form input.- Parameters:
name- The submit-body key (also the DOM identity for anactionfield). Must not benull or blank.label- The visible label. Must not benull or blank.type- One oftext,textarea,password,checkbox,toggle,select,action.null or blank defaults totext.- Returns:
- A new
FormDef.Input. - Throws:
IllegalArgumentException- Ifnameorlabelis blank, ortypeis not an allowed token.
-
required
Marks this input required.- Returns:
- This object.
-
required
Sets whether this input is required.- Parameters:
value-true to require a value;false omits the flag from the wire.- Returns:
- This object.
-
value
Sets the optional prefill.- Parameters:
value- The prefill. Can benull to unset.- Returns:
- This object.
-
options
Sets theselectoptions (replacing any existing).- Parameters:
value- The options. Must not benull .- Returns:
- This object.
- Throws:
IllegalArgumentException- Ifvalueisnull or contains anull entry.
-
option
Adds oneselectoption.- Parameters:
value- The submit value. Must not benull .label- The visible option text. Must not benull or blank.- Returns:
- This object.
- Throws:
IllegalArgumentException- Ifvalueisnull orlabelis blank.
-
pattern
Sets the client validation regexp (text/textareaonly).- Parameters:
value- The pattern. Can benull to unset.- Returns:
- This object.
-
maxLength
Sets the client max-length (text/textareaonly).- Parameters:
value- The max length. Must be> 0.- Returns:
- This object.
-
help
Sets the help hint (painted withtextContent).- Parameters:
value- The hint. Can benull to unset.- Returns:
- This object.
-
actionId
Sets the enclosing view's row-action id thisactionbutton opens.- Parameters:
value- The action id. Can benull to unset.- Returns:
- This object.
-
action
- Parameters:
value- The action reference. Must not benull .- Returns:
- This object.
- Throws:
IllegalArgumentException- Ifvalueisnull .
-