Can you mask data under a switch?

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

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,

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

1,701 views 24 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you