Can you mask data under a switch?

Ken Trough March 24, 2013

I'd like to display a phone number on a page, but I want the characters masked under a switch.

In other words, I want to display a phone number like this:

(***) ***-**** with a checkbox next to it that, when checked, reveals the actual number like this:

(360) 555-1212

No security issues. Just want to mask certain text by default requiring an extra click to reveal.

2 answers

1 accepted

3 votes
Answer accepted
GuilhermeA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 25, 2013

Hey Ken,

I could not mask as you would like, but would not be too difficult, just need to adapt my User Macro.

You'll need to create a custom macro with the following settings (the required ones):

  1. Name
  2. Title
  3. Rendered
  4. And the Code
    ## @param Name:title=Link|type=string|required=true|desc=Link to Click
    <script language="javascript"> 
    function toggle() {
    	var ele = document.getElementById("toggleText");
    	var text = document.getElementById("displayText");
    	if(ele.style.display == "block") {
        		ele.style.display = "none";
    		text.innerHTML = "$paramName";
      	}
    	else {
    		ele.style.display = "block";
    		text.innerHTML = "hide";
    	}
    } 
    </script>
     
    <a id="displayText" href="javascript:toggle();">$paramName</a>
    <div id="toggleText" style="display: none"><h1>$body</h1></div>

Please modify it to your needs, the usage would be, type {hide and select it from the drop-down. Then fill the link you'd like for people to click, could be "Click Me" or "Click to show my Number", and save. Then Place the number or text inside the block of code. And its done.

Hope this helps you, Cheers,

0 votes
Andrey Markelov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 4, 2013

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events