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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Changing Display Modes...
Power Apps
Answered

Changing Display Modes of Input Controls using buttons with variables

(0) ShareShare
ReportReport
Posted on by 196

Hello All, 

 

I'm trying to debug some issues I'm having.  I have a few Text Input controls that I have set to View mode through a variable in the OnSelect property of a gallery.  I also have (3) buttons (add,edit,save) that I would like to manipulate the display modes of the Text Inputs as well.  What I'm trying to accomplish is upon viewing the screen or viewing a record, I need the input controls to be set to viewmode.  When I select the "Add" button, I'd like the Text Inputs to change to DisplayMode.edit, same with the "Edit" button, though with the "Save" button, I'd like the inputs to revert back to DisplayMode.view.  Currently, when I select a record in the gallery, the inputs change to view mode, but that's as far as I have got.  Here is the breakdown of where I'm at....

 

OnSelect property of my gallery:  Set(varInspection,ThisItem); Set(varModeView,DisplayMode.View)

DisplayMode property of Text Inputs:  If(varModeView = DisplayMode.View,DisplayMode.View,DisplayMode.Edit)

Default property of Text Inputs:  varInspection.columnname (Inputs are standalone.....not in an EditForm)

 

Thus far, by selecting a record in the gallery, it changes the display modes of the text inputs to view.

 

My issue is I've tried adding some formulas to my buttons to achieve the display modes of what I want but I can't get anything to work right.  Can someone tell me what I need to add to these buttons by chance?

 

Overview of my buttons and other variables I've set:

-I've set a variable in OnSelect of my gallery to = Set(varInspection,ThisItem), the variable is then used in the default property of the input controls to show current selected record in the gallery.

 

- Add Btn= Purpose of this is to clear the input controls to blank so I am able to add a new record...currently has a variable through OnSelect = Set(varInspection,Blank()) which clears the Input Controls to blank

 

So....wrapping this together, I need these input controls to be in view mode initially upon a user viewing the screen without interacting with it.  I also need to add formulas to each of my buttons to manipulate the display modes of the input controls.  My apologies if some of this is a bit confusing but thank you in advance for any help....much appreciated!

 

Categories:
I have the same question (0)
  • Verified answer
    BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    Hi @DerrickH ,

     

    You almost have it, but there's two things:

     

    1. You can just set the DisplayMode property of the text input fields to varModeView . This will give the same result, but is cleaner.

    2. You need to also set varModeView in the OnSelect property of the buttons:

     

    AddButton.OnSelect = Set(varInspection, Blank()); Set varModeView, DisplayMode.Edit);
    
    EditButton.OnSelect = <what you already have>; Set varModeView, DisplayMode.Edit);
    
    SaveButton.OnSelect = <what you already have>; Set varModeView, DisplayMode.View);
    

     

     

  • DerrickH Profile Picture
    196 on at

    @BCBuizer worked flawlessly!  Thank you so much.  I have somewhat of a difficult time understanding how to use variables and now that seems pretty simple, ugh.  Just to gain a bit of understanding on these variables...once you've set the variable varModeView to DisplayMode.View, and added the variable to the Input....by changing the variables value in the button, all you are doing is changing what the variables value is in that instance?

  • BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    Hi @DerrickH ,

     

    There's only 1 instance of a variable and everything that references it will receive the current value. In this case the controls that reference varModeView from their DisplayMode property will have their behaviour follow the value of the variable in near real-time.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard