cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

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

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

8 REPLIES 8
Highlighted
Power Apps
Power Apps

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

Highlighted
Community Champion
Community Champion

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
Highlighted
New Member

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!

Highlighted
Kudo Commander
Kudo Commander

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?

Highlighted
Power Automate
Power Automate

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.

Highlighted
Regular Visitor

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
Frequent Visitor

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.

Highlighted
Advocate IV
Advocate IV

Re: Dropdown to update a form

Hi @CarlosFigueira,

 

Tried your idea, but since i'm writing directly on a SQL field it doesn't update the field. Even using a "submit form" the field won't update and gets back to normal.

 

My scenario is similar the one posted:

  1. Items on the card: ["EXPERIMENTAL","EXPERIMENTAL +","OFICIAL"]
  2. Update: 'Dropdown profissao'.Selected.Value

The field on SQL is a normal text / string field.

Thanks in advance

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (6,962)