An HTML input element of type password.
Use this component to get user input for a controller method that does not correspond to a field on a Salesforce object, for a value that is masked as the user types.
Click on the arrows to vote for the correct answer
A. B. C. D.C.
The correct answer is C. apex:inputSecret
.
Explanation:
In Apex and Visualforce Controllers, apex:inputSecret
is used to create an HTML input element of type password. This component is used to get user input for a controller method that does not correspond to a field on a Salesforce object, for a value that is masked as the user types.
For example, if you have a Visualforce page with a custom controller, and you want to collect a password from the user without displaying the actual characters entered, you would use apex:inputSecret
. Here's an example of how it would look in Visualforce:
php<apex:page controller="MyController"> <apex:form > <apex:inputSecret value="{!password}" /> <apex:commandButton value="Submit" action="{!savePassword}" /> </apex:form> </apex:page>
In the example above, the apex:inputSecret
component is used to collect the user's password, and the value
attribute is bound to a controller property called password
. When the user types in the password, the characters are masked, just like a regular password field. When the user clicks the submit button, the savePassword
method on the controller is called, which can then do whatever processing is needed with the password value.
To summarize, apex:inputSecret
is used to create a password field on a Visualforce page, and is used to get user input for a controller method that does not correspond to a field on a Salesforce object.