X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/530ef4b6c5b943cfa68b779d11cf7de29aa878bf..7a654f8d43fdb43d78b63d90528bed6e86b608cc:/docs/api/Ext.form.field.Field.html diff --git a/docs/api/Ext.form.field.Field.html b/docs/api/Ext.form.field.Field.html new file mode 100644 index 00000000..213724b8 --- /dev/null +++ b/docs/api/Ext.form.field.Field.html @@ -0,0 +1,274 @@ +Ext.form.field.Field | Ext JS 4.0 Documentation +
For up to date documentation and features, visit +http://docs.sencha.com/ext-js/4-0

Sencha Documentation

+ + + + + +

This mixin provides a common interface for the logical behavior and state of form fields, including:

+ +
    +
  • Getter and setter methods for field values
  • +
  • Events and methods for tracking value and validity changes
  • +
  • Methods for triggering validation
  • +
+ + +

*NOTE**: When implementing custom fields, it is most likely that you will want to extend the Ext.form.field.Base +component class rather than using this mixin directly, as BaseField contains additional logic for generating an +actual DOM complete with label and error message display and a form input field, +plus methods that bind the Field value getters and setters to the input field's value.

+ +

If you do want to implement this mixin directly and don't want to extend Ext.form.field.Base, then +you will most likely want to override the following methods with custom implementations: getValue, +setValue, and getErrors. Other methods may be overridden as needed but their base +implementations should be sufficient for common cases. You will also need to make sure that initField +is called during the component's initialization.

+
Defined By

Config Options

Other Configs

 

True to disable the field (defaults to false). Disabled Fields will not be +submitted.

+

True to disable the field (defaults to false). Disabled Fields will not be +submitted.

+
 
The name of the field (defaults to undefined). By default this is used as the parameter +name when including the field...

The name of the field (defaults to undefined). By default this is used as the parameter +name when including the field value in a form submit(). +To prevent the field from being included in the form submit, set submitValue to false.

+
 

Setting this to false will prevent the field from being +submitted even when it is not disabled. Defaults to true.

+

Setting this to false will prevent the field from being +submitted even when it is not disabled. Defaults to true.

+
 
Specifies whether this field should be validated immediately whenever a change in its value is detected. +Defaults to ...

Specifies whether this field should be validated immediately whenever a change in its value is detected. +Defaults to true. If the validation results in a change in the field's validity, a +validitychange event will be fired. This allows the field to show feedback about the +validity of its contents immediately as the user is typing.

+ + +

When set to false, feedback will not be immediate. However the form will still be validated +before submitting if the clientValidation option to Ext.form.Basic.doAction is +enabled, or if the field or form are validated manually.

+ + +

See also Ext.form.field.Base.checkChangeEventsfor controlling how changes to the field's value are detected.

+ +
 

A value to initialize this field with (defaults to undefined).

+

A value to initialize this field with (defaults to undefined).

+
Defined By

Properties

 
Clear any invalid styles/messages for this field. Components using this mixin should implement +this method to update ...

Clear any invalid styles/messages for this field. Components using this mixin should implement +this method to update the components rendering to clear any existing messages.

+ + +

Note: this method does not cause the Field's validate or isValid methods to +return true if the value does not pass validation. So simply clearing a field's errors +will not necessarily allow submission of forms submitted with the Ext.form.action.Submit.clientValidation +option set.

+ +
 

Flag denoting that this component is a Field. Always true.

+

Flag denoting that this component is a Field. Always true.

+
 
Associate one or more error messages with this field. Components using this mixin should implement +this method to upd...

Associate one or more error messages with this field. Components using this mixin should implement +this method to update the component's rendering to display the messages.

+ + +

Note: this method does not cause the Field's validate or isValid methods to +return false if the value does pass validation. So simply marking a Field as invalid +will not prevent submission of forms submitted with the Ext.form.action.Submit.clientValidation +option set.

+ +
 
The original value of the field as configured in the value configuration, or as loaded by +the last form load operatio...

The original value of the field as configured in the value configuration, or as loaded by +the last form load operation if the form's trackResetOnLoad +setting is true.

+
Defined By

Methods

 
A utility for grouping a set of modifications which may trigger value changes into a single +transaction, to prevent e...

A utility for grouping a set of modifications which may trigger value changes into a single +transaction, to prevent excessive firing of change events. This is useful for instance +if the field has sub-fields which are being updated as a group; you don't want the container +field to check its own changed state for each subfield change.

+

Parameters

  • fn : Object

    A function containing the transaction code

    +

Returns

  • void    +
 
Checks whether the value of the field has changed since the last time it was checked. If the value +has changed, it: + +...

Checks whether the value of the field has changed since the last time it was checked. If the value +has changed, it:

+ + +
    +
  1. Fires the change event,
  2. +
  3. Performs validation if the validateOnChange config is enabled, firing the +validationchange event if the validity has changed, and
  4. +
  5. Checks the dirty state of the field and fires the dirtychange event +if it has changed.
  6. +
+ +

Returns

  • void    +
 
Checks the isDirty state of the field and if it has changed since the last time +it was checked, fires the dirtychange...

Checks the isDirty state of the field and if it has changed since the last time +it was checked, fires the dirtychange event.

+

Returns

  • void    +
 
Only relevant if the instance's isFileUpload method returns true. Returns a reference +to the file input DOM element h...

Only relevant if the instance's isFileUpload method returns true. Returns a reference +to the file input DOM element holding the user's selected file. The input will be appended into +the submission form and will not be returned, so this method should also create a replacement.

+

Returns

  • HTMLInputElement    +
 
Runs this field's validators and returns an array of error messages for any validation failures. +This is called inter...

Runs this field's validators and returns an array of error messages for any validation failures. +This is called internally during validation and would not usually need to be used manually.

+ + +

Each subclass should override or augment the return value to provide their own errors.

+ +

Parameters

  • value : Mixed

    The value to get errors for (defaults to the current field value)

    +

Returns

  • Array   

    All error messages for this field; an empty Array if none.

    +
 
Returns the value(s) that should be saved to the Ext.data.Model instance for this field, when +Ext.form.Basic.updateRe...

Returns the value(s) that should be saved to the Ext.data.Model instance for this field, when +Ext.form.Basic.updateRecord is called. Typically this will be an object with a single name-value +pair, the name being this field's name and the value being its current data value. More +advanced field implementations may return more than one name-value pair. The returned values will be +saved to the corresponding field names in the Model.

+ + +

Note that the values returned from this method are not guaranteed to have been successfully +validated.

+ +

Returns

  • Object   

    A mapping of submit parameter names to values; each value should be a string, or an array +of strings if that particular name has multiple values. It can also return null if there are no +parameters to be submitted.

    +
 
Returns the name attribute of the field. This is used as the parameter +name when including the field value in a form ...

Returns the name attribute of the field. This is used as the parameter +name when including the field value in a form submit().

+

Returns

  • String   

    name The field name

    +
 
Returns the parameter(s) that would be included in a standard form submit for this field. Typically this +will be an o...

Returns the parameter(s) that would be included in a standard form submit for this field. Typically this +will be an object with a single name-value pair, the name being this field's name and the +value being its current stringified value. More advanced field implementations may return more than one +name-value pair.

+ + +

Note that the values returned from this method are not guaranteed to have been successfully +validated.

+ +

Returns

  • Object   

    A mapping of submit parameter names to values; each value should be a string, or an array +of strings if that particular name has multiple values. It can also return null if there are no +parameters to be submitted.

    +
 
Returns the current data value of the field. The type of value returned is particular to the type of the +particular f...

Returns the current data value of the field. The type of value returned is particular to the type of the +particular field (e.g. a Date object for Ext.form.field.Date).

+

Returns

  • Mixed   

    value The field value

    +
 
Initializes this Field mixin on the current instance. Components using this mixin should call +this method during thei...

Initializes this Field mixin on the current instance. Components using this mixin should call +this method during their own initialization process.

+

Returns

  • void    +
 
Returns true if the value of this Field has been changed from its originalValue. +Will always return false if the fiel...

Returns true if the value of this Field has been changed from its originalValue. +Will always return false if the field is disabled.

+ + +

Note that if the owning form was configured with +trackResetOnLoad +then the originalValue is updated when the values are loaded by +Ext.form.Basic.setValues.

+ +

Returns

  • Boolean   

    True if this field has been changed from its original value (and +is not disabled), false otherwise.

    +
 
isEqual( +Mixed value1, Mixed value2) + : Boolean
Returns whether two field values are logically equal. Field implementations may override +this to provide custom compa...

Returns whether two field values are logically equal. Field implementations may override +this to provide custom comparison logic appropriate for the particular field's data type.

+

Parameters

  • value1 : Mixed

    The first value to compare

    +
  • value2 : Mixed

    The second value to compare

    +

Returns

  • Boolean   

    True if the values are equal, false if inequal.

    +
 
Returns whether this Field is a file upload field; if it returns true, forms will use +special techniques for submitti...

Returns whether this Field is a file upload field; if it returns true, forms will use +special techniques for submitting the form via AJAX. See +Ext.form.Basic.hasUpload for details. If this returns true, the extractFileInput +method must also be implemented to return the corresponding file input element.

+

Returns

  • Boolean    +
 
Returns whether or not the field value is currently valid by validating the +field's current value. The validitychange...

Returns whether or not the field value is currently valid by validating the +field's current value. The validitychange event will not be fired; use validate +instead if you want the event to fire. Note: disabled fields are always treated as valid.

+ + +

Implementations are encouraged to ensure that this method does not have side-effects such as +triggering error message display.

+ +

Returns

  • Boolean   

    True if the value is valid, else false

    +
 
Resets the current field value to the originally loaded value and clears any validation messages. +See Ext.form.Basic....

Resets the current field value to the originally loaded value and clears any validation messages. +See Ext.form.Basic.trackResetOnLoad

+

Returns

  • void    +
 
Resets the field's originalValue property so it matches the current value. +This is called by Ext.form.Basic.setValues...

Resets the field's originalValue property so it matches the current value. +This is called by Ext.form.Basic.setValues if the form's +trackResetOnLoad property is set to true.

+

Returns

  • void    +
 
setValue( +Mixed value) + : Ext.form.field.Field

Sets a data value into the field and runs the change detection and validation.

+

Sets a data value into the field and runs the change detection and validation.

+

Parameters

  • value : Mixed

    The value to set

    +

Returns

  • Ext.form.field.Field   

    this

    +
 
Returns whether or not the field value is currently valid by validating the +field's current value, and fires the vali...

Returns whether or not the field value is currently valid by validating the +field's current value, and fires the validitychange event if the field's validity has +changed since the last validation. Note: disabled fields are always treated as valid.

+ + +

Custom implementations of this method are allowed to have side-effects such as triggering error +message display. To validate without side-effects, use isValid.

+ +

Returns

  • Boolean   

    True if the value is valid, else false

    +
Defined By

Events

 
change( +Ext.form.field.Field this, Mixed newValue, Mixed oldValue) +

Fires when a user-initiated change is detected in the value of the field.

+

Fires when a user-initiated change is detected in the value of the field.

+

Parameters

  • this : Ext.form.field.Field
    +
  • newValue : Mixed

    The new value

    +
  • oldValue : Mixed

    The original value

    +
 
dirtychange( +Ext.form.field.Field this, Boolean isDirty) +

Fires when a change in the field's isDirty state is detected.

+

Fires when a change in the field's isDirty state is detected.

+

Parameters

  • this : Ext.form.field.Field
    +
  • isDirty : Boolean

    Whether or not the field is now dirty

    +
 
validitychange( +Ext.form.field.Field this, Boolean isValid) +

Fires when a change in the field's validity is detected.

+

Fires when a change in the field's validity is detected.

+

Parameters

  • this : Ext.form.field.Field
    +
  • isValid : Boolean

    Whether or not the field is now valid

    +
\ No newline at end of file