cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
audrieg
Level 10

MessageBox

Good morning:

 

Is there a way to pop up a message box asking for input (for a variable)?

 

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: MessageBox

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:

DialogBox1.png

 

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.

View solution in original post

4 REPLIES 4
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: MessageBox

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:

DialogBox1.png

 

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.

View solution in original post

audrieg
Level 10

Re: MessageBox

I will give that a try! Thank you!

PowerApps Staff rgruian
PowerApps Staff

Re: MessageBox

We have added this idea/request to our backlog, and we will try to address it in the upcoming releases. Thanks!

Radu Gruian [MSFT] ** PowerApps Staff
fbxiii
Level: Powered On

Re: MessageBox

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.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 325 members 5,737 guests
Please welcome our newest community members: