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
DannyK89DannyK89 

Password field

I was thinking of creating a custom text field that will act as a password field. I was wondering if there is a way that I can make it act like a password field and when a user inputs characters they will show as '*' 

Best Answer chosen by Admin (Salesforce Developers) 
aballardaballard

You can use Apex:OutputLabel to generate labels.  (And I think something with $ObjectType to get the label corresponding to the field if you son't want to hard-code it).

 

Another option you might want to explore is Salesforce Encrypted Fields for your custom field.  This is an option that has to be enabled for your org so you have to contact support to use it.   But with this, InputField would do the masking automatically, and give you the normal label support etc...

All Answers

aballardaballard

In a visualforce page, <apex:inputSecret> 

 

 

DannyK89DannyK89

Cool, so that works for the most part. The only thing is that The Field Name does not show up. Is there a way for that to appear?

aballardaballard

You can use Apex:OutputLabel to generate labels.  (And I think something with $ObjectType to get the label corresponding to the field if you son't want to hard-code it).

 

Another option you might want to explore is Salesforce Encrypted Fields for your custom field.  This is an option that has to be enabled for your org so you have to contact support to use it.   But with this, InputField would do the masking automatically, and give you the normal label support etc...

This was selected as the best answer
BiswajeetBiswajeet
Use it in your visualforce page, here in "label" attribute you can enter your field name.
<apex:inputsecret label="Password" required="true"/>