You need to sign in to do that
Don't have an account?
How to toogle between password visibility in visualforce
<apex:page controller="SignUpPage">
<apex:form >
<apex:pageBlock title="Profile Details">
*Required Field
<apex:pageBlockSection >
<apex:inputText value="{!sup.User_Name__c}" label="User Name *"/>
<br></br>
<apex:inputsecret value="{!sup.Type_Password__c}" label="Type Password *"/>
<br></br>
<apex:inputsecret value="{!sup.Retype_Password__c}" label="Retype Password *"/>
<br></br>
<apex:commandButton value="Create Profile" action="{!CreateProfile}"/><br></br>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
<apex:form >
<apex:pageBlock title="Profile Details">
*Required Field
<apex:pageBlockSection >
<apex:inputText value="{!sup.User_Name__c}" label="User Name *"/>
<br></br>
<apex:inputsecret value="{!sup.Type_Password__c}" label="Type Password *"/>
<br></br>
<apex:inputsecret value="{!sup.Retype_Password__c}" label="Retype Password *"/>
<br></br>
<apex:commandButton value="Create Profile" action="{!CreateProfile}"/><br></br>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
You are just one step away,All you have to do is just create a checkbox and add the
onclick event (that will toggle the inputsecret field).
1.First Create a checkbox corresponding to inputSecretField:
(i.e) <apex:inputCheckbox id="checkbx" onclick="toggle();" />
2.Create a javascript method inside vf page:
Note:--{ Upass is my password field Id and checkbx is my checkbox id }
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com
All Answers
You are just one step away,All you have to do is just create a checkbox and add the
onclick event (that will toggle the inputsecret field).
1.First Create a checkbox corresponding to inputSecretField:
(i.e) <apex:inputCheckbox id="checkbx" onclick="toggle();" />
2.Create a javascript method inside vf page:
Note:--{ Upass is my password field Id and checkbx is my checkbox id }
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com
<script>
function toggle(){
var showPasswordCheckBox = document.getElementById('{!$Component.frm.theblock.thesection.checkbx}');
if(showPasswordCheckBox.checked){
document.getElementById('{!$Component.frm.theblock.thesection.Upass}').type="TEXT";
}else{
document.getElementById('{!$Component.frm.theblock.thesection.Upass}').type="PASSWORD";
}
}
</script>
<apex:form >
<apex:pageBlock title="Profile Details" id="theblock">
*Required Field
<apex:pageBlockSection id="thesection">
<apex:inputText value="{!sup.User_Name__c}" label="User Name *" />
<br></br>
<apex:inputsecret id="Upass" value="{!sup.Type_Password__c}" label="Type Password *"/>
<br></br>
<apex:inputCheckbox id="checkbx" onclick="toggle();" />
<br></br>
<apex:inputsecret value="{!sup.Retype_Password__c}" label="Retype Password *"/>
<br></br>
<apex:commandButton value="Create Profile" action="{!CreateProfile}"/><br></br>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
I did this but it didn't work