cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jean-Paul
Level: Powered On

How to: show/hide a text hint

I've created a Powerapp with survey questions.

Each question has additional information/hints but in order to keep things clean I want to hide this text by default and give the user a button to open the hint.

 

Currently I've done this by making a new card and setting the onselect feature of the question text to set the visability of the card with the text to true. But this is a lot of work for multiple questions. Also the hints tend to show up all the way down.

 

Is there a more simple way to show\hide text hints per question? (Tooltip isn't an option because that doesn't work on the phones)

2017-03-21 13_47_16-HSO Position Preformance ‎- PowerApps.png2017-03-21 13_47_35-HSO Position Preformance ‎- PowerApps.png

3 REPLIES 3
hpkeong
Level 10

Re: How to: show/hide a text hint

HI

 

I understand your question but really clear.

In order to set something visible / invisible, you need to set the:

- TextBox.Text.Visible = vis (or any context variable name, up to you)

- Button.OnSelect = UpdateContext({vis: true}); UpdateContext({vis: false}) (this action is always in PAIR)

 

If you wish to Toggle the Hint Text, then write:

- UpdateContext({vis: !vis})

 

You may also have all the Hint Text hidden when navigate the the screen, by setting the UpdateContext during

- Screen.OnVisible

 

If you have multiple hints, and wish to show at different time / action, then, you have to set the Context Variable for each of them.

 

Hope this helps.

 

Have a nice day.

hpkeong
ojje
Level: Power Up

Re: How to: show/hide a text hint

Where should I write:

 

UpdateContext({vis: !vis})

 
Anonymous
Not applicable

Re: How to: show/hide a text hint

You should probably include that code

UpdateContext({vis: !vis})

on the OnSelect property of the text boxes. Then use the vis context variable to control the Visible property of the cards. I think that's what you did before.

 

As for your first question, I don't think there's an easier way of doing it. I'm assuming you're using a Canvas/Edit Form object since you're adding cards and stuff. If you're displaying each hint on its own card, you have to make multiple cards, a card for each question. 

 

You've also mentioned that all the hints tend to expand when you open one hint. Have you tried using multiple context variables (more work, I know)?

Something like this:

OnSelect property for Question 1 Label:
    UpdateContext({ VisibleHint_Qn1: !VisibleHint_Qn1 })

Visible property for Hint 1 Card:
    VisibleHint_Qn1

OnSelect property for Question 2 Label:
    UpdateContext({ VisibleHint_Qn2: !VisibleHint_Qn2 })

Visible property for Hint 2 Card:
    VisibleHint_Qn2

... and so on.
You should also initialize the context variables before the screen is made. 
I usually do it in OnVisible property of the screen where the objects are. Something like this: UpdateContext({
VisibleHint_Qn1: false,
VisibleHint_Qn2: false
})

 

EDIT: Formatting fixes. 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,587)