Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.gwtext.client.widgets.form
Class Field

    java.lang.Object
      com.google.gwt.user.client.ui.UIObject
          com.google.gwt.user.client.ui.Widget
              com.gwtext.client.widgets.Component
                  com.gwtext.client.widgets.BoxComponent
                      com.gwtext.client.widgets.form.Field

All Implemented Interfaces:
  com.google.gwt.user.client.EventListener, Observable

Direct Known Subclasses:
  Checkbox, Hidden, HtmlEditor, TextField, TimeField

    public abstract class Field

extends BoxComponent

Base class for form fields that provides default event handling, sizing, value handling and other functionality.

Field Summary

Fields inherited from class com.gwtext.client.widgets.Component
`config, id`

Constructor Summary
`Field()`
`Field(com.google.gwt.core.client.JavaScriptObject jsObj)`
`Field(java.lang.String fieldLabel)`
`Field(java.lang.String fieldLabel, java.lang.String name)`
`Field(java.lang.String fieldLabel, java.lang.String name, int width)`

Method Summary
`void` | `addListener(FieldListener listener)` Add a Field Listener.
`void` | `applyTo(com.google.gwt.user.client.Element element)` Apply the behaviors of this component to an existing element.
`void` | `applyTo(java.lang.String id)` Apply the behaviors of this component to an existing element.
`void` | `clearInvalid()` Clear any invalid styles/messages for this field.
`protected abstract com.google.gwt.core.client.JavaScriptObject` | `create(com.google.gwt.core.client.JavaScriptObject config)`
`java.lang.String` | `getClearCls()` The CSS class used to provide field clearing (defaults to 'x-form-clear-left')
`java.lang.String` | `getCls()` CSS class to apply to the field's underlying element
`java.lang.String` | `getFocusClass()` The CSS class to use when the field receives focus (defaults to "x-form-focus").
`java.lang.String` | `getInputType()` The type attribute for input fields -- e.g.
`java.lang.String` | `getInvalidClass()` The CSS class to use when marking a field invalid (defaults to "x-form-invalid").
`java.lang.String` | `getInvalidText()` The error text to use when marking a field invalid and no message is provided (defaults to "The value in this field is invalid").
`java.lang.String` | `getLabelSeparator()` The seprator between the fields label and the field.
`java.lang.String` | `getLabelStyle()` The CSS style of the fields label.
`java.lang.String` | `getName()` Returns the name attribute of the field if available.
`java.lang.String` | `getRawValue()` Returns the raw data value which may or may not be a valid, defined value.
`int` | `getTabindex()` The tabIndex for this field.
`int` | `getValidationDelay()` The length of time in milliseconds after user input begins until validation is initiated (defaults to 250).
`java.lang.String` | `getValueAsString()` Return the value of the field as a String.
`java.lang.String` | `getXType()` Gets the xtype for this component as registered with ComponentMgr.
`boolean` | `isAutoCreate()`
`boolean` | `isDirty()` Returns true if this field has been changed since it was originally loaded and is not disabled.
`boolean` | `isHideLabel()`
`boolean` | `isReadOnly()`
`boolean` | `isValid()` Returns whether or not the field value is currently valid.
`boolean` | `isValid(boolean preventMark)` Returns whether or not the field value is currently valid.
`boolean` | `isValidateOnBlur()` Whether the field should validate when it loses focus (defaults to true).
`void` | `markInvalid(java.lang.String message)` Mark this field as invalid.
`void` | `reset()` Resets the current field value to the originally loaded value and clears any validation messages.
`void` | `setAutoCreate(boolean autoCreate)` Set to true for a default element spec (defaults to {tag: "input", type: "text", size: "20", autocomplete: "off"})
`void` | `setAutoCreate(DomConfig domConfig)` A DomHelper config spec to use for field creation.
`void` | `setClearCls(java.lang.String clearCls)` The CSS class used to provide field clearing (defaults to 'x-form-clear-left')
`void` | `setCls(java.lang.String cls)` A CSS class to apply to the field's underlying element.
`void` | `setDisabled(boolean disabled)` True to disable the field (defaults to false).
`void` | `setFieldClass(java.lang.String fieldClass)` The default CSS class for the field (defaults to "x-form-field").
`void` | `setFieldLabel(java.lang.String fieldLabel)` Set the fields label.
`void` | `setFieldMsgTarget(java.lang.String msgTarget)` The location where error text should display.
`void` | `setFocusClass(java.lang.String focusClass)` The CSS class to use when the field receives focus (defaults to "x-form-focus").
`void` | `setHideLabel(boolean hideLabel)` True to completely hide the label element (defaults to false).
`void` | `setInputType(java.lang.String inputType)` The type attribute for input fields -- e.g.
`void` | `setInvalidClass(java.lang.String invalidClass)` The CSS class to use when marking a field invalid (defaults to "x-form-invalid").
`void` | `setInvalidText(java.lang.String invalidText)` The error text to use when marking a field invalid and no message is provided (defaults to "The value in this field is invalid").
`void` | `setLabel(java.lang.String fieldLabel)` Set the fields label.
`void` | `setLabelSeparator(java.lang.String labelSeparator)` The seprator between the fields label and the field.
`void` | `setLabelStyle(java.lang.String labelStyle)` Set the CSS style of the fields label.
`void` | `setMsgFx(java.lang.String msgFx)` The effect used when displaying a validation message under the field (defaults to 'normal').
`static void` | `setMsgTarget(java.lang.String msgTarget)` Set the location of the error message target globally.
`void` | `setName(java.lang.String name)` Set the field's HTML name attribute.
`void` | `setRawValue(java.lang.String value)` Sets the underlying DOM field's value directly, bypassing validation.
`void` | `setReadOnly(boolean readOnly)` True to mark the field as readOnly in HTML (defaults to false) -- Note: this only sets the element's readOnly DOM attribute.
`void` | `setTabIndex(int tabIndex)` The tabIndex for this field.
`void` | `setValidateOnBlur(boolean validateOnBlur)` Whether the field should validate when it loses focus (defaults to true).
`void` | `setValidationDelay(int validationDelay)` The length of time in milliseconds after user input begins until validation is initiated (defaults to 250).
`void` | `setValidationEvent(boolean validationEvent)` Set to false to disable automatic validation.
`void` | `setValidationEvent(java.lang.String validationEvent)` The event that should initiate field validation.
`void` | `setValue(java.lang.String value)` A value to initialize this field with.
`void` | `setWidth(int width)` Set the width of the field.
`void` | `setWidth(java.lang.String width)` Set the width of the field.
`boolean` | `validate()`

Methods inherited from class com.gwtext.client.widgets.BoxComponent
`addListener, doOnRender, doOnRender, getAutoHeight, getAutoWidth, getBox, getBox, getConfigPrototype, getHeight, getPosition, getPosition, getSize, getWidth, setAutoHeight, setAutoWidth, setHeight, setHeight, setPagePosition, setPosition, syncSize, updateBox`

Methods inherited from class com.gwtext.client.widgets.Component
`addClass, addClassCreated, addEvent, addEvents, addListener, addListener, addListener, afterRender, beforeDestroy, check, cloneComponent, cloneComponent, cloneConfig, destroy, disable, enable, equals, error, focus, focus, focus, getApplyTo, getAttribute, getAttributeAsBoolean, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAutoShow, getComponentJS, getConfig, getCtCls, getDisabledClass, getEl, getElement, getElement, getHideMode, getHideParent, getId, getItemId, getJsObj, getOffsetHeight, getOffsetWidth, getOrCreateJsObj, getOwnerContainer, getRenderTo, getStateEvents, getStateId, getStyle, getStyleElement, getTitle, getXTypes, hashCode, hide, initComponent, isCreated, isDisabled, isHidden, isRendered, isVisible, isXType, isXType, onDestroy, removeClass, render, render, render, render, render, render, setApplyTo, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAutoEl, setAutoShow, setCtCls, setDisabledClass, setEl, setEl, setHideMode, setHideParent, setId, setRenderTo, setStateEvents, setStateId, setStyle, setTitle, setVisible, show`

Methods inherited from class com.google.gwt.user.client.ui.Widget
`doAttachChildren, doDetachChildren, getParent, isAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setElement`

Methods inherited from class com.google.gwt.user.client.ui.UIObject
`addStyleDependentName, addStyleName, getAbsoluteLeft, getAbsoluteTop, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, removeStyleDependentName, removeStyleName, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, sinkEvents, toString, unsinkEvents`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Field

    public Field()

### Field

    public Field(java.lang.String fieldLabel)

### Field

    public Field(java.lang.String fieldLabel,
                 java.lang.String name)

### Field

    public Field(java.lang.String fieldLabel,
                 java.lang.String name,
                 int width)

### Field

    public Field(com.google.gwt.core.client.JavaScriptObject jsObj)

Method Detail

### setMsgTarget

    public static void setMsgTarget(java.lang.String msgTarget)

  Set the location of the error message target globally.

  Parameters:
    `msgTarget` - supported values are 'qtip' (default) and 'side'

### create

    protected abstract com.google.gwt.core.client.JavaScriptObject create(com.google.gwt.core.client.JavaScriptObject config)

  Overrides:
    `create` in class `BoxComponent`

### applyTo

    public void applyTo(java.lang.String id)

  Apply the behaviors of this component to an existing element. This is used instead of render().

  Parameters:
    `id` - the ID of the node

### applyTo

    public void applyTo(com.google.gwt.user.client.Element element)

  Apply the behaviors of this component to an existing element. This is used instead of render().

  Parameters:
    `element` - the element

### clearInvalid

    public void clearInvalid()

  Clear any invalid styles/messages for this field.

### getName

    public java.lang.String getName()

  Returns the name attribute of the field if available.

  Returns:
    the name attribute of the Field

### getRawValue

    public java.lang.String getRawValue()

  Returns the raw data value which may or may not be a valid, defined value.

  Returns:
    the raw field value

### getValueAsString

    public java.lang.String getValueAsString()

  Return the value of the field as a String.

  Returns:
    value as String

### isDirty

    public boolean isDirty()

  Returns true if this field has been changed since it was originally loaded and is not disabled.

  Returns:
    true if field changed

### isValid

    public boolean isValid()

  Returns whether or not the field value is currently valid.

  Returns:
    true if valid

### isValid

    public boolean isValid(boolean preventMark)

  Returns whether or not the field value is currently valid.

  Parameters:
    `preventMark` - true to disable marking the field invalid
  Returns:
    true if valid

### markInvalid

    public void markInvalid(java.lang.String message)

  Mark this field as invalid.

  Parameters:
    `message` - the validation message

### reset

    public void reset()

  Resets the current field value to the originally loaded value and clears any validation messages.

### setRawValue

    public void setRawValue(java.lang.String value)

  Sets the underlying DOM field's value directly, bypassing validation. To set the value with validation use `setValue(String)`.

  Parameters:
    `value` - field value

### validate

    public boolean validate()

### addListener

    public void addListener(FieldListener listener)

  Add a Field Listener.

  Parameters:
    `listener` - the listener

### getXType

    public java.lang.String getXType()

  Description copied from class: `Component`
  Gets the xtype for this component as registered with ComponentMgr. For a list of all available xtypes, see the Component javadocs.

       TextField field = new TextField();
       field.getXType() returns "textfield"

  Overrides:
    `getXType` in class `BoxComponent`
  Returns:
    the xtype

### setAutoCreate

    public void setAutoCreate(boolean autoCreate)
                       throws java.lang.IllegalStateException

  Set to true for a default element spec (defaults to {tag: "input", type: "text", size: "20", autocomplete: "off"})

  Parameters:
    `autoCreate` - true for a default element spec
  Throws:
    `java.lang.IllegalStateException` - this property cannot be changed after the Component has been rendered

### isAutoCreate

    public boolean isAutoCreate()

### setAutoCreate

    public void setAutoCreate(DomConfig domConfig)
                       throws java.lang.IllegalStateException

  A DomHelper config spec to use for field creation.

  Parameters:
    `domConfig` - a DomHelper config spec to use for field creation
  Throws:
    `java.lang.IllegalStateException` - this property cannot be changed after the Component has been rendered

### setClearCls

    public void setClearCls(java.lang.String clearCls)
                     throws java.lang.IllegalStateException

  The CSS class used to provide field clearing (defaults to 'x-form-clear-left')

  Parameters:
    `clearCls` - the CSS class used to provide the clearing
  Throws:
    `java.lang.IllegalStateException` - this property cannot be changed after the Component has been rendered

### getClearCls

    public java.lang.String getClearCls()

  The CSS class used to provide field clearing (defaults to 'x-form-clear-left')

  Returns:
    the clear Class

### setCls

    public void setCls(java.lang.String cls)
                throws java.lang.IllegalStateException

  A CSS class to apply to the field's underlying element.

  Overrides:
    `setCls` in class `Component`
  Parameters:
    `cls` - the CSS class
  Throws:
    `java.lang.IllegalStateException` - this property cannot be changed after the Component has been rendered

### getCls

    public java.lang.String getCls()

  CSS class to apply to the field's underlying element

  Overrides:
    `getCls` in class `Component`
  Returns:
    the CSS class

### setDisabled

    public void setDisabled(boolean disabled)

  True to disable the field (defaults to false).

  Overrides:
    `setDisabled` in class `Component`
  Parameters:
    `disabled` - true to disable

### setFieldClass

    public void setFieldClass(java.lang.String fieldClass)
                       throws java.lang.IllegalStateException

  The default CSS class for the field (defaults to "x-form-field").

  Parameters:
    `fieldClass` - the fields class
  Throws:
    `java.lang.IllegalStateException` - this property cannot be changed after the Component has been rendered

### setFocusClass

    public void setFocusClass(java.lang.String focusClass)

  The CSS class to use when the field receives focus (defaults to "x-form-focus").

  Parameters:
    `focusClass` - CSS class on focus

### getFocusClass

    public java.lang.String getFocusClass()

  The CSS class to use when the field receives focus (defaults to "x-form-focus").

  Returns:
    the focus class

### setLabel

    public void setLabel(java.lang.String fieldLabel)

  Set the fields label. Alias for `setFieldLabel(String)`

  Parameters:
    `fieldLabel` - the field label

### setFieldLabel

    public void setFieldLabel(java.lang.String fieldLabel)

  Set the fields label.

  Parameters:
    `fieldLabel` - the field label

### setHideLabel

    public void setHideLabel(boolean hideLabel)
                      throws java.lang.IllegalStateException

  True to completely hide the label element (defaults to false).

  Parameters:
    `hideLabel` - true to completely hide the label element (defaults to false)
  Throws:
    `java.lang.IllegalStateException` - this property cannot be changed after the Component has been rendered

### isHideLabel

    public boolean isHideLabel()

### setInputType

    public void setInputType(java.lang.String inputType)
                      throws java.lang.IllegalStateException

  The type attribute for input fields -- e.g. radio, text, password (defaults to "text").

  Parameters:
    `inputType` - the input type
  Throws:
    `java.lang.IllegalStateException` - this property cannot be changed after the Component has been rendered

### getInputType

    public java.lang.String getInputType()

  The type attribute for input fields -- e.g. radio, text, password (defaults to "text").

  Returns:
    the input type

### setInvalidClass

    public void setInvalidClass(java.lang.String invalidClass)

  The CSS class to use when marking a field invalid (defaults to "x-form-invalid").

  Parameters:
    `invalidClass` - CSS class when field is invalid

### getInvalidClass

    public java.lang.String getInvalidClass()

  The CSS class to use when marking a field invalid (defaults to "x-form-invalid").

  Returns:
    the invalid CSS class

### setInvalidText

    public void setInvalidText(java.lang.String invalidText)

  The error text to use when marking a field invalid and no message is provided (defaults to "The value in this field is invalid"). This error message is displayed when the used specified validator returns false.

  Parameters:
    `invalidText` - invalid text on error
  See Also:
    `TextField.setValidator(Validator)`

### getInvalidText

    public java.lang.String getInvalidText()

  The error text to use when marking a field invalid and no message is provided (defaults to "The value in this field is invalid"). This error message is displayed when the used specified validator returns false.

  Returns:
    the invalid text

### setLabelStyle

    public void setLabelStyle(java.lang.String labelStyle)
                       throws java.lang.IllegalStateException

  Set the CSS style of the fields label. For example 'display:none'.

  Parameters:
    `labelStyle` - the CSS style for the fields label
  Throws:
    `java.lang.IllegalStateException` - this property cannot be changed after the Component has been rendered

### getLabelStyle

    public java.lang.String getLabelStyle()

  The CSS style of the fields label.

  Returns:
    the label style

### setLabelSeparator

    public void setLabelSeparator(java.lang.String labelSeparator)
                           throws java.lang.IllegalStateException

  The seprator between the fields label and the field. Can use ' ' or '&nbsp;'

  Parameters:
    `labelSeparator` - the label separator
  Throws:
    `java.lang.IllegalStateException` - this property cannot be changed after the Component has been rendered

### getLabelSeparator

    public java.lang.String getLabelSeparator()

  The seprator between the fields label and the field.

  Returns:
    the label separator

### setMsgFx

    public void setMsgFx(java.lang.String msgFx)

  The effect used when displaying a validation message under the field (defaults to 'normal'). Other possible values are "slide" and "slideRight"

  Parameters:
    `msgFx` - validation message style

### setFieldMsgTarget

    public void setFieldMsgTarget(java.lang.String msgTarget)
                           throws java.lang.IllegalStateException

  The location where error text should display. Should be one of the following values (defaults to 'qtip') :

       Value         Description
       -----------   ----------------------------------------------------------------------
       qtip          Display a quick tip when the user hovers over the field
       title         Display a default browser title attribute popup
       under         Add a block div beneath the field containing the error text
       side          Add an error icon to the right of the field with a popup on hover
       [element id]  Add the error text directly to the innerHTML of the specified element

  Parameters:
    `msgTarget` - the error message target
  Throws:
    `java.lang.IllegalStateException` - this property cannot be changed after the Component has been rendered

### setName

    public void setName(java.lang.String name)
                 throws java.lang.IllegalStateException

  Set the field's HTML name attribute.

  Parameters:
    `name` - the fields name
  Throws:
    `java.lang.IllegalStateException` - this property cannot be changed after the Component has been rendered

### setReadOnly

    public void setReadOnly(boolean readOnly)
                     throws java.lang.IllegalStateException

  True to mark the field as readOnly in HTML (defaults to false) -- Note: this only sets the element's readOnly DOM attribute.

  Parameters:
    `readOnly` - true to mark field read only
  Throws:
    `java.lang.IllegalStateException` - this property cannot be changed after the Component has been rendered

### isReadOnly

    public boolean isReadOnly()

### setTabIndex

    public void setTabIndex(int tabIndex)
                     throws java.lang.IllegalStateException

  The tabIndex for this field. Note this only applies to fields that are rendered, not those which are built via applyTo.

  Parameters:
    `tabIndex` - the fields tab index
  Throws:
    `java.lang.IllegalStateException` - this property cannot be changed after the Component has been rendered

### getTabindex

    public int getTabindex()

  The tabIndex for this field.

  Returns:
    the tab index

### setValidateOnBlur

    public void setValidateOnBlur(boolean validateOnBlur)

  Whether the field should validate when it loses focus (defaults to true).

  Parameters:
    `validateOnBlur` - true to validate on blur

### isValidateOnBlur

    public boolean isValidateOnBlur()

  Whether the field should validate when it loses focus (defaults to true).

  Returns:
    true if validate on blur

### setValidationDelay

    public void setValidationDelay(int validationDelay)
                            throws java.lang.IllegalStateException

  The length of time in milliseconds after user input begins until validation is initiated (defaults to 250).

  Parameters:
    `validationDelay` - the validation delay in milliseconds
  Throws:
    `java.lang.IllegalStateException` - this property cannot be changed after the Component has been rendered

### getValidationDelay

    public int getValidationDelay()

  The length of time in milliseconds after user input begins until validation is initiated (defaults to 250).

  Returns:
    the validation delay

### setValidationEvent

    public void setValidationEvent(boolean validationEvent)
                            throws java.lang.IllegalStateException

  Set to false to disable automatic validation.

  Parameters:
    `validationEvent` - false to disable automatic validation
  Throws:
    `java.lang.IllegalStateException` - this property cannot be changed after the Component has been rendered

### setValidationEvent

    public void setValidationEvent(java.lang.String validationEvent)

  The event that should initiate field validation. (defaults to "keyup")..

  Parameters:
    `validationEvent` - event to initiate validation

### setValue

    public void setValue(java.lang.String value)

  A value to initialize this field with.

  Parameters:
    `value` - the field value

### setWidth

    public void setWidth(int width)
                  throws java.lang.IllegalStateException

  Set the width of the field.

  Overrides:
    `setWidth` in class `BoxComponent`
  Parameters:
    `width` - the field width
  Throws:
    `java.lang.IllegalStateException` - this property cannot be changed after the Component has been rendered

### setWidth

    public void setWidth(java.lang.String width)
                  throws java.lang.IllegalStateException

  Set the width of the field.

  Overrides:
    `setWidth` in class `BoxComponent`
  Parameters:
    `width` - the field width
  Throws:
    `java.lang.IllegalStateException` - this property cannot be changed after the Component has been rendered

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD