web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Toggle visible and ref...
Power Apps
Answered

Toggle visible and refresh data in fields.

(0) ShareShare
ReportReport
Posted on by 120

Hi everybody;

I want to make a toggle to hide/unhide some cards on a form and refresh data in these cards to default or blank if it unchecks.

Screen Shot 2019-11-05 at 10.17.22 AM.png

How can I do that?

Categories:
  • v-monli-msft Profile Picture
    Microsoft Employee on at

    Hi @carem ,

     

    Set the OnUncheck property of each toggle controls to:

    ResetForm(FormName)

     

    Regards,

    Mona 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    For hide/unhide use a variable:

     

    Hide: Toggle.OnUnCheck = UpdateContext({ varHide: false })

    Unhide: Toggle.OnCheck = UpdateContext({ varHide: true })

     

    then for any datacards you wish to hide/unhide

    DataCard.Visible = varHide

     

    Follow Sik's comment for the refresh

  • carem Profile Picture
    120 on at

    @v-monli-msft @Anonymous 

    I don't want to refresh entire form. I want to set the value or text of fields invisible from switch toggle become 0 or blank.

    Example above:

    I want when I switch the first toggle: All the fields in the first line invisible and set the value of that field to 0/blank.

    Similar to the 2nd line.

    How I can do that?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @carem my comment will work for your hide/unhide part

     

    for the reset, are the default properties of your DataCards 0/blank? If so, you could add the Reset() function to my above OnCheck code like this:

     

    Toggle.OnCheck = [above code ] ; Reset(DataCard1); Reset(DataCard2) ...

     

    If the datacard values are not 0/blank then you'll likely have to create an If() statement

  • carem Profile Picture
    120 on at

    @Anonymous 

    Reset() function will work perfect if the form is in New Mode.

    But if the Form is in Edit Mode, Reset() will return the default value of this item, it's mean it will return the old data of these fields.

    Can you give me more information about the approach with "if statement" you mention above?

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @carem the If() statement will sit in the Default property of each card, eg

     

    I assume your DataCards default values look something like:

    eg. DataCard.Default = ThisItem.'Child age'

     

    Change it to:

    DataCard.Default = If( !varHide, Blank(), ThisItem.'Child age')

    If you are not yet aware, you need to unlock each datacard before you can change any of their properties.

     

    Also, when I had a quick play with hiding datacards, when I hid an entire row/line the line below moved up. That's going to get a little messy to control - and don't ask me how to do it - please 🙂

     

    Also, when I tested I used two variable, one for each line. I think that may work better?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 223

Last 30 days Overall leaderboard