cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NotJohnSnow
Level: Powered On

Dropdown to update a form

Hi,

 

I created a form and you like to update the information by using a dropdown so the user can only have a
few options to choose from rather than a textbox. How do I do this?

 

My Datacard has an update function that I have set as Dropdown1.Selected.text

 

My Dropdown1 has Default set to Parent.Default

and Items set:

Table({Text: "Good", Val: 1}, {Text: "Bad", Val: 2}, {Text: "Need Assistance", Val: 3}, {Text: "Waiting", Val: 4})

 

The items is like that becasue I have been trying to get it to recognize the Items as a text so I could update since it gave me an error when I had ["Good", "Bad", "Need Assistance", "Waiting"] and Dropdown1.Selected.Value saying something about needing to be a text value. Now when I try and run it it doesn't update,.

1 ACCEPTED SOLUTION

Accepted Solutions
Power Apps Staff CarlosFigueira
Power Apps Staff

Re: Dropdown to update a form

I had a similar problem in the past, trying to use a custom card to update a field - it does not work (the team is working on updates to make the experience clearer).

 

To show how you could do that, I'll go over all the steps that I did to use a dropdown in a form. As a sample data, I'm using this excel table (named ScoobyDoo) in my Dropbox account:

Scooby1.PNG

I used the "Create an app drom your data" option to create an app based on that excel table. That gave me an app with three screens, a browse gallery, and two screens with forms (a view form and an edit form). Going to the edit form (in the EditScreen), it will have a card bound to the Species column:, with a textbox that I wanted to switch to a dropdown.

Scooby2.PNG

The first thing you'll need to do is to "unlock" the card so that you can change the controls. In the options pane, you can expand the ellipsis and choose the "Advanced Options"

Once you are in the Advanced options, you can click the "unlock" button to allow you to change which controls you want to use.

 

At this point, you can now add a dropdown, and set the following properties:

Items: Table({ Text: "Human" }, { Text: "Dog" }, { Text: "Monster" })
Default: Parent.Default

And remove the original text edit control. Notice that when you do that, an error will appear in the card: there is a hidden control (called ErrorMessage<N>) whose Y property is bound to the Y property of the control that was removed. If you select it, you can change it to reference the new Dropdown control instead, or simply move it to use a fixed position.

 

Now all you need to do is to change the Update property on the data card itself. If you select the data card (it will have a tooltip saying "Card: Species" in this case), then you'll change the Update property to use the value from the dropdown.

Update: Dropdown2.Selected.Text

 

Ok, that is a detailed way to get your scenario going. Notice that it is a lot of work, and the team is working to make this more efficient in the future.

 

Hope this helps!

View solution in original post

7 REPLIES 7
Power Apps Staff CarlosFigueira
Power Apps Staff

Re: Dropdown to update a form

I had a similar problem in the past, trying to use a custom card to update a field - it does not work (the team is working on updates to make the experience clearer).

 

To show how you could do that, I'll go over all the steps that I did to use a dropdown in a form. As a sample data, I'm using this excel table (named ScoobyDoo) in my Dropbox account:

Scooby1.PNG

I used the "Create an app drom your data" option to create an app based on that excel table. That gave me an app with three screens, a browse gallery, and two screens with forms (a view form and an edit form). Going to the edit form (in the EditScreen), it will have a card bound to the Species column:, with a textbox that I wanted to switch to a dropdown.

Scooby2.PNG

The first thing you'll need to do is to "unlock" the card so that you can change the controls. In the options pane, you can expand the ellipsis and choose the "Advanced Options"

Once you are in the Advanced options, you can click the "unlock" button to allow you to change which controls you want to use.

 

At this point, you can now add a dropdown, and set the following properties:

Items: Table({ Text: "Human" }, { Text: "Dog" }, { Text: "Monster" })
Default: Parent.Default

And remove the original text edit control. Notice that when you do that, an error will appear in the card: there is a hidden control (called ErrorMessage<N>) whose Y property is bound to the Y property of the control that was removed. If you select it, you can change it to reference the new Dropdown control instead, or simply move it to use a fixed position.

 

Now all you need to do is to change the Update property on the data card itself. If you select the data card (it will have a tooltip saying "Card: Species" in this case), then you'll change the Update property to use the value from the dropdown.

Update: Dropdown2.Selected.Text

 

Ok, that is a detailed way to get your scenario going. Notice that it is a lot of work, and the team is working to make this more efficient in the future.

 

Hope this helps!

View solution in original post

hpkeong
Level 10

Re: Dropdown to update a form

Hi Carlos:

 

I agree with you. I have to go thru the same tedious work (though not too bad) to change from TextInput to Dropdown.

In fact, in the tutorial, PG showed there are such functions in the example but just wonder why it is not in this edition. I guess PG staff are using upcoming edition and now we are still using preview edition.

Not only Dropdown, it shall also include other options:
- Slider

- Camera (Now, only AddPicture is supported in EditForm; I had tried with [image] in Excel Field, and only AddPicture is set as default)

- ListBox

- Radio Button, etc.

 

Looking forward to PG Team to have all these included so that after unlocking, changes can be made more efficient.

(so that Parent.Default, Dropdown.Selected.Value, Error position ... do not need to be amended manually and resulting in a lot of mistake).

 

I always admire your good explanation.

 

One question: when I replied, I can;t insert with Ctrl-V / Paste. What happen? before that it was wasy and I can see that you can insert easily. Please advise so that I can share, when replying, with better explanation instead of long explanation.

TQ

hpkeong
NotJohnSnow
Level: Powered On

Re: Dropdown to update a form

Thanks a bunch,

 

I was able to create it after I finagled with the excel spreadsheet that I was using and then just following your steps! Much appreciated sir!

hintbw-abc
Level 8

Re: Dropdown to update a form

I've gotten this working, but I notice when I submit the form to update the value that it switches back briefly to the previous value the field had before switching (again) to the value that had just been set. Ultimately that is the outcome I want, but it can be a little disorienting for the user.

 

Anyone else that has implemented this solution for using dropdowns to choose the value instead of textboxes notice the same thing happening?

Power Automate Staff audrieg
Power Automate Staff

Re: Dropdown to update a form

Yes. me too. I actually have it working the way I want on the form, but I see the old value popping back up before being saved correctlyl, I'm not getting any error message to help me troubleshoot. I'll post an answer if I figure out why.

Elfman
Level: Powered On

Re: Dropdown to update a form

I have same issue my radio controls always remembering previous value which is very user unfrendly how to reset them to show nothing anyone can help please?

Highlighted
masterOfNone
Level: Powered On

Re: Dropdown to update a form

Brilliant answer. I agree that there is MUCH need for greater clarification on how to bind updates to data cards with custom controls and data. Very confusing and not intutive, although the solution is quite simple.

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps 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

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,479)