Represents an input field that corresponds to a field on a Salesforce object. This component respects the attributes of the associated field. For example, if the component is a number field with 2 decimal places, then the default input value contains the same number of decimal places. Bind the field using the value attribute and provide a default value to initialize the object.
<aura:attribute name="contact" type="Contact" default="{ 'sobjectType': 'Contact' }"/> <force:inputField aura:id="contactName" value="{!v.contact.Name}"/>
Use a different input component such as ui:inputText if you're working with user input that does not correspond to a field on a Salesforce object.
Attribute Name | Attribute Type | Description | Required? |
---|---|---|---|
body | Component[] | The body of the component. In markup, this is everything in the body of the tag. | |
class | String | The CSS style used to display the field. | |
errorComponent | Component[] | A component which is responsible for displaying the error message. | |
required | Boolean | Specifies whether this field is required or not. | |
value | Object | Data value of Salesforce field to which to bind. |
Event Name | Event Type | Description |
---|---|---|
change | COMPONENT | The event fired when the user changes the content of the input. |