I added a textbox called TextBox1
to my PowerApps
form.
Then in the OnSelect
and OnChange
Actions/Events I add the following code
TextBox1.Text="Hallo world"
When I run the app and change the select values in the dropdown then the textbox text does not change.
Why does the OnChange
or OnSelect
events not get triggered?
The expression TextBox1.Text="Hallo world"
doesn't mean an assignment in PowerApps as it does in many programming languages. Instead, it is a boolean expression, with no side effects (it will compare the text property of the text box with the string "Hallo world"
.
If you want to use variables, you need to use the UpdateContext function. In your case, you'd have something like this in the OnChange/OnSelect property of a control:
UpdateContext({ myVar: "Hallo world" })
And set the Text property of the TextBox1 to myVar
.
This doc has more information on the use of variables in PowerApps.