Forum Discussion

viswaaa's avatar
viswaaa
Helper IV
1 year ago
Solved

Show/Hide Textbox based on button

Hi All,

 

I have a requirement where I need to show/hide my textbox based on clicking the info button.

If the user clicks on info button I need to show textbox which has a note in it.

And then again if the user clicks on the same info button I need to hide the text box.

 

Please suggest how to do this.I tried with bookmarks but not able to get this

    • Bookmark 1: Text box is hidden.

    • Bookmark 2: Text box is visible.

    ➤ Bookmark 1 (Textbox Hidden)

    1. Hide the textbox (NoteTextBox):

      • Click the textbox → press eye icon in the Selection pane to hide it.

      • Or go to ViewSelection Pane, and hide it from there.

    2. Go to ViewBookmarks Pane.

    3. Click Add → Rename it to HideNote.

    4. Click the next to the bookmark → Check only:

      • Data: OFF

      • Display: ON

      • Current Page: ON

      • All Visuals: ON

         

    ➤ Bookmark 2 (Textbox Visible)

    1. Show the textbox by clicking the eye icon again in the Selection Pane.

    2. In the Bookmarks Pane:

      • Click Add → Rename it to ShowNote.

      • Same settings as above: Only Display, Current Page, and All Visuals checked.


    Step 4: Add Bookmark Actions to the Info Button

    Since a Power BI button can only be assigned one action at a time, we will use a workaround with two overlapping buttons.

    ➤ Create Two Info Buttons

    1. Duplicate the InfoButton. Now you have:

      • InfoButton_Show → will show the textbox

      • InfoButton_Hide → will hide the textbox

    2. Assign actions:

      • InfoButton_Show → set Action = BookmarkShowNote

      • InfoButton_Hide → set Action = BookmarkHideNote

         

         

    ➤ Set Visibility of Buttons Using Bookmarks

    • In HideNote:

      • Show InfoButton_Show

      • Hide InfoButton_Hide

      • Hide NoteTextBox

    • In ShowNote:

      • Show InfoButton_Hide

      • Hide InfoButton_Show

      • Show NoteTextBox

    This creates a toggle effect: clicking InfoButton_Show reveals the text and switches to InfoButton_Hide, and clicking that hides it again.

     

    Reference:



    Use the name and content you desire based on the requirement.

     

    If resolved, Mark as Solution to guide others!

     

3 Replies

    • Bookmark 1: Text box is hidden.

    • Bookmark 2: Text box is visible.

    ➤ Bookmark 1 (Textbox Hidden)

    1. Hide the textbox (NoteTextBox):

      • Click the textbox → press eye icon in the Selection pane to hide it.

      • Or go to ViewSelection Pane, and hide it from there.

    2. Go to ViewBookmarks Pane.

    3. Click Add → Rename it to HideNote.

    4. Click the next to the bookmark → Check only:

      • Data: OFF

      • Display: ON

      • Current Page: ON

      • All Visuals: ON

         

    ➤ Bookmark 2 (Textbox Visible)

    1. Show the textbox by clicking the eye icon again in the Selection Pane.

    2. In the Bookmarks Pane:

      • Click Add → Rename it to ShowNote.

      • Same settings as above: Only Display, Current Page, and All Visuals checked.


    Step 4: Add Bookmark Actions to the Info Button

    Since a Power BI button can only be assigned one action at a time, we will use a workaround with two overlapping buttons.

    ➤ Create Two Info Buttons

    1. Duplicate the InfoButton. Now you have:

      • InfoButton_Show → will show the textbox

      • InfoButton_Hide → will hide the textbox

    2. Assign actions:

      • InfoButton_Show → set Action = BookmarkShowNote

      • InfoButton_Hide → set Action = BookmarkHideNote

         

         

    ➤ Set Visibility of Buttons Using Bookmarks

    • In HideNote:

      • Show InfoButton_Show

      • Hide InfoButton_Hide

      • Hide NoteTextBox

    • In ShowNote:

      • Show InfoButton_Hide

      • Hide InfoButton_Show

      • Show NoteTextBox

    This creates a toggle effect: clicking InfoButton_Show reveals the text and switches to InfoButton_Hide, and clicking that hides it again.

     

    Reference:



    Use the name and content you desire based on the requirement.

     

    If resolved, Mark as Solution to guide others!

     

  • Bookmarks can be a nightmare to maintain so instead I'd use a dummy table containing a single row blank column and add it to a tile slicer. The slicer uses a page as a tooltip. Make it so the slicer is competely transparent and there's only one cell (1x1 grid).

     

    Please see the attached pbix.

  • v-kpoloju-msft's avatar
    v-kpoloju-msft
    Community Support

    Hi viswaaa,

    Thank you for reaching out to the Microsoft Community Forum. Also, thanks to danextianMohamedFowzan1, for those inputs on this thread.

    I understand you are trying to toggle the visibility of a textbox using a single info button in Power BI show it on first click and hide it on the next. You have tried bookmarks but could not get the toggle behaviour working totally understandable.

    Unfortunately, Power BI does not support true toggle functionality with a single button, since each button can only be tied to one specific bookmark. But no worries there is a reliable workaround using two bookmarks and two overlapping buttons to simulate toggle behaviour.

    Create your textbox with the note you want to show/hide. Open the Bookmarks pane (View > Bookmarks) and create two bookmarks. ShowInfo: textbox visible. HideInfo: textbox hidden. Open the Selection pane (View > Selection) and add two buttons: InfoButton1: shown when textbox is hidden, triggers ShowInfo.
    InfoButton2: shown when textbox is visible, triggers HideInfo. Place them in the exact same spot, so it looks like a toggle.

    In each bookmark, ensure the visibility of the textbox and buttons is set correctly: In ShowInfo, textbox and InfoButton2 are visible, InfoButton1 is hidden. In HideInfo, textbox and InfoButton2 are hidden, InfoButton1 is visible. Set each button’s Action to the corresponding bookmark in the Format pane > Action.

    Kindly refer to the below mentioned documentation links for better understanding:
    Create and configure buttons in Power BI reports - Power BI | Microsoft Learn
    Create report bookmarks in Power BI - Power BI | Microsoft Learn

    Hope this helps clarify things and let me know what you find after giving these steps a try happy to help you investigate this further.

    Thank you for using the Microsoft Community Forum.