Class idx.form._CompositeMixin
Mix-in class to provide customized label, hint, unit, and field layout, implemented according to
IBM One UI(tm) Text Areas & Fields.
It takes the assumption that a composite widget will follow the dom structure below
<div class="idxComposite">
<div class="idxLabel">
<span>*</span>
<label dojotAttachPoint="compLabelNode">Label Text</label>
</div>
<div>other dom structure...</div><div dojoAttachPoint="compUnitNode">unit text</div>
<div dojoAttachPoint="compHintNode" class="idxHint dijitHidden">hint text</div>
</div>
Defined in: <idx\form\_CompositeMixin.js>.
Constructor Summary
Constructor Attributes | Constructor Name and Description |
---|---|
Field Summary
Field Attributes | Field Name and Description |
---|---|
Width of the field with a hidden validation icon
|
|
Help message popup from help icon follows label.
|
|
For input widgets only.
|
|
For input widgets only.
|
|
Label text
|
|
Layout of the label and the field, "horizontal" or "vertical", implemented according to
IBM One UI(tm) Field & Label Alignment
|
|
Width from the left of label to the left of corresponding field, this parameter works in the composite widget layout of "horizontal".
|
|
Indicates that it's a required field or not.
|
|
The text of unit for the numerical value input widget.
|
Method Summary
Method Attributes | Method Name and Description |
---|---|
_setFieldWidthAttr(width)
Set the width of field with a hidden validation icon.
|
|
_setHintAttr(hint)
Set the hint text
|
|
_setLabelAlignmentAttr(alignment)
Set the alignment for the label and field, update the style of the label node to make
it be at the right place.
|
|
_setLabelAttr(label)
Set the label text.
|
|
_setLabelWidthAttr(width)
Set the width of label, the width is from the start of label to the start of the field.
|
|
_setRequiredAttr(required)
Set this field as a required field or not.
|
|
_setUnitAttr(unit)
Set the text of unit
|
|
reset()
Reset the value and state of the composite widget.
|
|
resize()
Handles resizing form widgets.
|
|
Validate value, directly get focus and show error if turn out to be invalid.
|
Field Detail
{String | Number} fieldWidth
Width of the field with a hidden validation icon
{String} help
Help message popup from help icon follows label.
{String} hint
For input widgets only. The hint text.
{String} hintPosition
For input widgets only. The position of the hint text: "inside" / "outside", inner the field input or not.
- Default Value:
- "inside"
{String} label
Label text
{String} labelAlignment
Layout of the label and the field, "horizontal" or "vertical", implemented according to
IBM One UI(tm) Field & Label Alignment
- Default Value:
- "horizontal"
{String | Number} labelWidth
Width from the left of label to the left of corresponding field, this parameter works in the composite widget layout of "horizontal".
{boolean} required
Indicates that it's a required field or not. A required field will have a red asterisk.
implemented according to
IBM One UI(tm) Required Fields.
- Default Value:
- false
{String} unit
The text of unit for the numerical value input widget.
Method Detail
_setFieldWidthAttr(width)
Set the width of field with a hidden validation icon.
- Parameters:
- {string | number} width
- Unit of "pt","em","px" will be normalized to "px", and "px" by default for numeral value.
_setHintAttr(hint)
Set the hint text
- Parameters:
- {string} hint
- The text will be displayed inside or below the TextBox per the "position" attribute.
_setLabelAlignmentAttr(alignment)
Set the alignment for the label and field, update the style of the label node to make
it be at the right place.
- Parameters:
- {string} alignment
- The alignment of the label and field. Can be "vertical" or "horizontal". If "vertical" is used, the label is put above the TextBox. If "horizontal" is used, the label is put on the left of the TextBox (on the right of the TextBox if RTL language is used).
_setLabelAttr(label)
Set the label text. Update the content of the label node.
- Parameters:
- {string} label
- The text will be displayed as the content of the label. If text is null or empty string, nothing would be displayed.
_setLabelWidthAttr(width)
Set the width of label, the width is from the start of label to the start of the field.
- Parameters:
- {string | number} width
- Unit of "pt","em","px" will be normalized to "px", and "px" by default for numeral value.
_setRequiredAttr(required)
Set this field as a required field or not. If this field is required,
a red asterisk will be shown at the start of label.
- Parameters:
- {boolean} required
_setUnitAttr(unit)
Set the text of unit
- Parameters:
- {string} unit
- The unit will be displayed on the right of the input box(on the left of the input box if RTL language is used).
postMixInProperties()
reset()
Reset the value and state of the composite widget.
resize()
Handles resizing form widgets.
validateAndFocus()
Validate value, directly get focus and show error if turn out to be invalid.