Class: SC.FieldView


Extends SC.Control, SC.Validatable, SC.View.

Base view for managing a view backed by an input element. Since the web browser provides native support for editing input elements, this view provides basic support for listening to changes on these input elements and responding to them.

Generally you will not work with a FieldView directly. Instead, you should use one of the subclasses implemented by your target platform such as SC.CheckboxView, SC.RadioView, SC.TextFieldView, and so on.

Defined in: field.js

Since:
SproutCore 1.0

Field Summary

Instance Methods

Instance Method Detail

$input()

Override to return an CoreQuery object that selects the input elements for the view. If this method is defined, the field view will automatically edit the attrbutes of the input element to reflect the current isEnabled state among other things.

acceptsFirstResponder()

Override of SC.Responder.prototype.acceptsFirstResponder.

Tied to the isEnabledInPane state.

didCreateLayer()

SC.View view state callback.

After the layer is created, set the field value and begin observing change events on the input field.

fieldValue()

fieldisMouseDown: NO,

/** The raw value of the field itself. This is computed from the 'value' property by passing it through any validator you might have set. This is the value that will be set on the field itself when the view is updated.

fieldValueDidChange(partialChange)

Your class should call this method anytime you think the value of the input element may have changed. This will retrieve the value and update the value property of the view accordingly.

If this is a partial change (i.e. the user is still editing the field and you expect the value to change further), then be sure to pass YES for the partialChange parameter. This will change the kind of validation done on the value. Otherwise, the validator may mark the field as having an error when the user is still in mid-edit.

Parameters:
partialChange
(optional) YES if this is a partial change.
Returns:
Boolean|SC.Error
result of validation.
getFieldValue()

Override to retrieve the actual value of the field.

The default implementation will simply retrieve the value attribute from the first input tag in the receiver view.

Returns:
String
value
keyDown(evt)

SC.RootResponder event handler.

Simply allow keyDown & keyUp to pass through to the default web browser implementation.

Parameters:
evt
mouseDown(evt)

SC.RootResponder event handler.

Allow the browser to do its normal event handling for the mouse down event. But first, set isActive to YES.

Parameters:
evt
mouseEntered(evt)

SC.RootResponder event handler.

If mouse was down and we renter the button area, set the active state again.

Parameters:
evt
mouseExited(evt)

SC.RootResponder event handler.

Remove the active class on mouseExited if mouse is down.

Parameters:
evt
mouseUp(evt)

SC.RootResponder event handler.

On mouse up, remove the isActive class and then allow the browser to do its normal thing.

Parameters:
evt
setFieldValue(newValue)

Override to set the actual value of the field.

The default implementation will simple copy the newValue to the value attribute of any input tags in the receiver view. You can override this method to provide specific functionality needed by your view.

Parameters:
newValue Object
the value to display.
Returns:
SC.FieldView
receiver
willDestroyLayer()

SC.View state callback.

Removes the change event from the input field.

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Apr 08 2015 10:02:20 GMT-0600 (CST)