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 / Change value in text i...
Power Apps
Unanswered

Change value in text input with button OnSelect

(0) ShareShare
ReportReport
Posted on by 2

Apologies if I am doing something very stupid here, but I have spent most of the day stuck on this and I am more confused now than when I started.

 

I have a gallery and form from an Excel Online for Business data connection, so most values are being read from the spreadsheet using the Parent.Default value.

 

I have a column called "Disabled", which has a Yes/No value. The default in the system I am pulling the data from is "No".

 

I have a button that changes the text label from Disable to Enable, based on the value from the "Disabled" field. This is a Switch statement in the Text Property;

Switch(
UserDisabled.Text,
"No", "Disable",
"Yes", "Enable",
"Disable"
)

 

For the OnSelect property I want to set "Yes" if the existing value is "No", and vice versa.

 

As mentioned, when the existing value is "No" I have my "Disable" text shown on the button, and when it is "Yes" I have my "Enable" text shown, so this works.

 

I understand from reading up that I need to set a variable to access the Text property of the Text input field, I assume the variable is set on the "Default" property of the "Disabled" field, and that, as this is a single screen app I should be using "UpdateContext", rather than "Set", please correct me if I have that wrong. I have tried both.

 

When I have tried to set a variable I seem to lose the connection to the datasource(as I lose the "Parent.Default" value and don't seem to be able to use that as a value for a variable), and I also get an immediate error whenever I am using the syntax I have seen in various posts;

 

UpdateContext({varDisabledStatus: "whatever, incl. Parent.Default"...}), or Set(varDisabledStatus, "No"). 

 

And the corresponding If statement in the OnSelect Property of the Disable/Enable button shows an error as well.

 

I have stripped everything back several times and started again to try and avoid any variables persisting, but I am still getting nowhere.

 

I have 2 other buttons, Add and Modify, and they work fine, it is just this last one that needs to switch the existing read in value from "Yes" to "No" and vice versa.

 

Any help would be appreciated. Hopefully this makes sense?

 

 

Categories:
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Netan 

    Please provide some context.  Is the button and textinput box on a form, in a gallery or freestanding?  It sounds like a form but I'm just checking.

  • Netan Profile Picture
    2 on at

    Sorry, yes, it is a formForm.PNG

    I am intending to hide the "Disabled" field once the form is live, as the editors will not need to see it, if the buttons are working as intended.

  • Tripondisco Profile Picture
    33 on at

    How could you do this in a gallery?

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