3

I need to display phone no in XXX-XXX-9999 format like if my phone no. is 1234567892 then it should display in XXX-XXX-7892. Similarly my email should also be displayed in a****@****d.com eg. If my email id is [email protected] then it should display in a****@****l.com.

I know we can do this using some javascript but I want to know if we can achieve this using some standard functionality like the date format given below

<apex:outputText value="{0, date, MMMM d','  yyyy}">
    <apex:param value="{!NOW()}" />
</apex:outputText>
1

1 Answer 1

4

JavaScript masking only hides in the rendered HTML output. Anyone can use developer tools to see the actual value. The best approach is to use Encryption as suggested by @highfive. But you can use combination of RIGHT and LEFT functions to get similar result in VF page. Hope this helps.

<apex:page standardController="Contact" >
    <apex:outputText value="XXX-XXX-{!RIGHT(Contact.MobilePhone,4)}"></apex:outputText><br></br>
    <apex:outputText value="{!LEFT(Contact.Email,1)}****@***{!RIGHT(Contact.Email,5)}"></apex:outputText>
</apex:page>

Screen

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .