+ Start a Discussion
sreeesreee 

Diff between Inputfield and inputtext

Diff between Inputfield and inputtext  ......can any one help me? Thx in Advance

kiranmutturukiranmutturu
inputfield --> input element for a value that corresponds to a field on a Salesforce object

inputtext --> input element of type text. and you can Use this component to get user input for a controller method that does not correspond to a field on a Salesforce object.

sreeesreee

thx for ur reply


i have doubt ....i have read some book....field level security is applicable for inputfield and for inputtext its not applicable...plz clarify.

sfdcfoxsfdcfox
InputField is a dynamic binding to a field. It can't be used on non-SObject variables (e.g. a String or a DateTime value). It automatically renders the correct control based on the field's definition. If the user cannot edit that field because of Field Level Security, then the inputField instead renders as a read-only outputField. Similarly, if the referenced field is not accessible because of Field Level Security, it is rendered as if the "rendered" attribute was false (in other words, no code or data is output for the field).

InputText, on the other hand, always renders a normal text field. It can be bound to an SObject field or a regular variable of any data type that can be coerced into text, including numbers. If the "disabled" attribute is not present or is false, the field is editable. If the "rendered" attribute is not present or is true, the field is rendered on the screen. Field Level Security is not taken into consideration. Most importantly, this means that users may be able to view or edit data they should not have access to.

It is considered a bad practice to use inputText when referencing any database data, because that can circumvent normal database security for that field. You should use inputText only when you know that the data is necessary for the page and is irrespective of the administrator's configuration of the database.