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 / How to toggle to enabl...
Power Apps
Answered

How to toggle to enable and disable a textfield

(2) ShareShare
ReportReport
Posted on by 24

Hello community,

I'm new to PowerApps. I want to use the toggle button to enable or disable a field in a form. 

I wrote this formulas but it gave me error. Much appreciate if you can give me an idea how to fix it.

 

OnChange = If(Toggle2 = true, DataCardValue42.DisplayMode.Edit, DataCardValue42.DisplayMode.Disabled)

 

Thanks

toggle formula.jpg
Categories:
  • Verified answer
    poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @lilyd99 

     

     

    Don't put this in the OnChange. Put this in the DisplayMode of the DataCard itself 

     

    On the OnChange, that should only set Toggle2 and that's it. Or more simply, just reference the control directly.

     

    So your DisplayMode property of DataCard can be simplified to just something like this:

     

     

    If(CheckBoxControl.Value, DisplayMode.Edit, DisplayMode.Disabled)

     

     

  • lilyd99 Profile Picture
    24 on at

    thank you. it works.

  • lilyd99 Profile Picture
    24 on at

    thanks for your  help

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 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard