PowerApps How can I change the text in a textbox on the click of a button

Mark Tait picture Mark Tait · Feb 28, 2018 · Viewed 8.4k times · Source

I'm trying to do a simple task of changing the text in a text box, on the click of a button in PowerApps.

I have a button "Button1" - and a textbox "TextInput2" on my page.

The buttons OnSelect action is set to: TextInput2.Text = "hello"

Nothing happens when I click the button. The textbox's text remains unchanged.

I also tried UpdateContext({TextInput2:"Hi"}) in the OnSelect action of the button.

Is there a way of doing this in PowerApps, that I may just be missing?

Thank you, Mark

Answer

Mark Tait picture Mark Tait · Feb 28, 2018

Finally getting my head around PowerApps.

Set the textbox's text property to:

If(HasBeenPressed, "Hello", "GoodBye")

Set the button's OnSelect event to:

UpdateContext({HasBeenPressed:true})

...and it's working.

I hope this helps others.