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})

If you appreciated my comments/responses please be sure to Like/Kudo them it really does make me smile 🙂 !

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})

If you appreciated my comments/responses please be sure to Like/Kudo them it really does make me smile 🙂 !

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
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (3,224)