cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Fa1con74
Helper III
Helper III

displaying a field according to the value of a toggle button

Hello,

 

I want to display some fields only if my toggle button is enabled

So I put in visible of my screen :

 

UpdateContext({aVisible: false})

 

In the visible of my fields

 

aVisible

 

And in visible from my toggle button

 

Switch(DataCardValue50.Value;true;UpdateContext({aVisible:true});UpdateContext({aVisisble:false}))

 

But it doesn't work and I don't understand why 🤔?

1 ACCEPTED SOLUTION

Accepted Solutions
AJ_Z
Super User
Super User

change the visible of the toggle back to true as the switch to update the variable should not be there 🙂

 

Now there are two ways to do the next step the first is this:

make the OnChange Property this:
UpdateContext({aVisible:Self.Value})
this is the quickest way

 

the other way is to make the 
OnCheck Property this:
UpdateContext({aVisible:true})

and the OnUnCheck property this:
UpdateContext({aVisible:false})



Signature:


If you appreciated my comments/responses please be sure to Like/Kudo them it really does make me smile 🙂 !
Link to the Power Platform Professionals United Kingdom User Group:

https://powerusers.microsoft.com/t5/Power-Platform-Professionals/gh-p/PowerPlatformProfessionalsUnit...

View solution in original post

3 REPLIES 3
WarrenBelz
Super User
Super User

Hi @Fa1con74 ,'

Assuming DataCardValue50 is your toggle control, the Visible of your controls simply needs to be

DataCardValue50.Value

If you want to keep running with the Variable, do this

UpdateContext({aVisible:DataCardValue50.Value})

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

AJ_Z
Super User
Super User

change the visible of the toggle back to true as the switch to update the variable should not be there 🙂

 

Now there are two ways to do the next step the first is this:

make the OnChange Property this:
UpdateContext({aVisible:Self.Value})
this is the quickest way

 

the other way is to make the 
OnCheck Property this:
UpdateContext({aVisible:true})

and the OnUnCheck property this:
UpdateContext({aVisible:false})



Signature:


If you appreciated my comments/responses please be sure to Like/Kudo them it really does make me smile 🙂 !
Link to the Power Platform Professionals United Kingdom User Group:

https://powerusers.microsoft.com/t5/Power-Platform-Professionals/gh-p/PowerPlatformProfessionalsUnit...

gyanchandkabra
Regular Visitor

Hi, 

 

On the Visible property of the field for which you want to hide and show, you can directly specify the ToggleField.Value or if(ToggleField.Value, True, false).

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (1,848)