Good morning:
Is there a way to pop up a message box asking for input (for a variable)?
Thank you.
Solved! Go to Solution.
Not really - the ability to show pop ups to the user (both to just present text and to request input) isn't part of the platform. Please create a new entry in the PowerApps Ideas Board if you feel that this feature is important.
You can, however, simulate a pop-up by "drawing" your pop-up on top of the screen (i.e., a Rectangle shape, a text box to indicate the caption, a text input for the user to enter the value, and a button to confirm the data entry), and set the Visible of those controls to a variable (variables default to false). When you want to show the dialog, you would set that variable to true. Notice that this wouldn't be a modal dialog, so you would need to make the dialog cover the whole screen to prevent the user from interacting with other controls while the dialog is showing.
Here's a more detailed example of how this can be accomplish. For simplicity sake, I'm drawing the dialog not on top of the "trigger" button:
And setting the following properties:
Button1.Text: "Click to open input box" Button1.OnSelect: UpdateContext({variableDefault:" "});UpdateContext({showDialog:true,variableDefault:""}) TextBox1.Text: "Value entered: " & variable Rectangle1.Visible: showDialog TextBox2.Visible: showDialog TextBox2.Text: "Enter the value:" TextInput1.Visible: showDialog TextInput1.Default: variableDefault ButtonOK.Visible: showDialog ButtonOK.OnSelect: UpdateContext({showDialog:false,variable:TextInput1.Text}) ButtonCancel.Visible: showDialog ButtonCancel.OnSelect: UpdateContext({showDialog:false})
When clicking the first button, it changes the value of the 'variableDefault' variable to clear the value in the text input from the dialog, and then setting the 'showDialog' to true. When the cancel button is pressed, it only hides the dialog, but when the OK button is pressed, then it also updates the variable value with the text from the input.
Not really - the ability to show pop ups to the user (both to just present text and to request input) isn't part of the platform. Please create a new entry in the PowerApps Ideas Board if you feel that this feature is important.
You can, however, simulate a pop-up by "drawing" your pop-up on top of the screen (i.e., a Rectangle shape, a text box to indicate the caption, a text input for the user to enter the value, and a button to confirm the data entry), and set the Visible of those controls to a variable (variables default to false). When you want to show the dialog, you would set that variable to true. Notice that this wouldn't be a modal dialog, so you would need to make the dialog cover the whole screen to prevent the user from interacting with other controls while the dialog is showing.
Here's a more detailed example of how this can be accomplish. For simplicity sake, I'm drawing the dialog not on top of the "trigger" button:
And setting the following properties:
Button1.Text: "Click to open input box" Button1.OnSelect: UpdateContext({variableDefault:" "});UpdateContext({showDialog:true,variableDefault:""}) TextBox1.Text: "Value entered: " & variable Rectangle1.Visible: showDialog TextBox2.Visible: showDialog TextBox2.Text: "Enter the value:" TextInput1.Visible: showDialog TextInput1.Default: variableDefault ButtonOK.Visible: showDialog ButtonOK.OnSelect: UpdateContext({showDialog:false,variable:TextInput1.Text}) ButtonCancel.Visible: showDialog ButtonCancel.OnSelect: UpdateContext({showDialog:false})
When clicking the first button, it changes the value of the 'variableDefault' variable to clear the value in the text input from the dialog, and then setting the 'showDialog' to true. When the cancel button is pressed, it only hides the dialog, but when the OK button is pressed, then it also updates the variable value with the text from the input.
I will give that a try! Thank you!
We have added this idea/request to our backlog, and we will try to address it in the upcoming releases. Thanks!
Crude but it works. I have set the DisplayMode to Disabled for my controls when the 'dialog box' is visible:
If(showDialog = false,DisplayMode.Edit,DisplayMode.Disabled)
I also had to Update the context variable when the screen On Visible event occurs as my controls were remaining disabled otherwise:
UpdateContext({variableDefault:" "});UpdateContext({showDialog:false,variableDefault:" "})
It's hard to believe basic functionality like Dialog / Message / Input boxes were not included as 'out of the box' features.
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
202 | |
187 | |
80 | |
50 | |
38 |
User | Count |
---|---|
304 | |
249 | |
123 | |
73 | |
55 |