function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
johnc82johnc82 

inputField vs inputText

I've searched but no real luck.  Can someone tell me the differences between inputField and inputText?

Ritesh AswaneyRitesh Aswaney

inputField needs to bind to a field of an sObject, where as inputText can bind to a commonplace controller variable.

 

Along the same lines, an outputFIeld pulls through the formatting information as well, so a field of type email will display with a hyperlink et all

srilakshmi1.387861669756762E12srilakshmi1.387861669756762E12
Input field by definition:
An HTML input element for a value that corresponds to a field on a Salesforce object. The < apex:inputField > component respects the attributes of the associated field, including whether the field is required or unique, and the user interface widget to display to get input from the user. For example, if the specified < apex:inputField > component is a date field, a calendar input widget is displayed. When used in an < apex:pageBlockSection >, < apex:inputField > tags always display with their corresponding output label. - from component reference

In simple language - It's the field on the object and you can have any data type, which users can input . Example Picklist, look up, check box and / or multi select picklist etc......

Where as Input text by definition -



An HTML input element of type text. Use this component to get user input for a controller method that does not correspond to a field on a Salesforce object.

This component does not use Salesforce styling. Also, since it does not correspond to a field, or any other data on an object, custom code is required to use the value the user inputs. - from component reference.

This is a field on the object which is of data type Text . Users can use to input only text using this field.

You cannot use this for picklists , check boxes or any other data type.

Please let me know if this helped in understanding the difference. If not you can go through the Component reference which will give you in detail explanation along with the usage.

your org/apexpages/apexcomponents.apexp

or even  VF developer guide as Mattybme1 suggested.