cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper III
Helper III

Set default selection for drop-down in Edit Form

Hello,

 

i have seen many posts here on the subject of drop-downs but still cannot figure out how to do this. In DataCard14 I have a drop-down box in my New Form(DataCardValue14). The data source is the Events table. Events has a lookup field from the Homes table. I want a value from Homes to prepopulate this drop-down control as the default for the New Form.

 

Thanks!

19 REPLIES 19

Oops, I may have spoken too soon. I thought I tested this before and it worked, so I may have done something else that broke. Although my default values do indeed show up when creating a new entry, trying to submit the form via the standard "check" button returns an error: "The requested operation is invalid. Server Response: A value must be provide for item." Also, when I edit items in the EditForm, the previous records become replaced with my default items due to the Distinct() function.

 

Unfortunatley I cannot seem to "roll back" to before I had default items because there is a difference between what PowerApps generates and when you drag dropdown controls manually from the Content tab. (i.e., no Items field).

It sounds like the dropdown is not connected as the update value for that card, it should look like this DropdownName.Selected.Value. You may want to check that out. Also the default property should simply be ThisItem.ColumnName. If these are correct and you're still getting the error, this might help you get back to where you were before the change.

 

https://powerapps.microsoft.com/en-us/guided-learning/learning-manage-version-apps/

Thank you, setting the defaults back to ThisItem solved the issue with the Edit values switching to my defaults. So now I am back to not being able to set default values. I still see the Server error message when clicking the check box. I have checked all my fields for Defaults and Updates and they all seem to be correct. I am wondering if my context variable is causing the issue:

 

Item.jpg

 

This context variable (galleryvar1) is in place because I have three galleries, each with their own navigation heading.

 

I should point out this happens when editing an existing item and also when trying to create a new item. So currently I cannot enter any data into my Sharepoint list via this app.

 

Not sure if the context variable has anything to do with that. You might want to duplicate your edit screen and use that as your new form. This will allow you to have the edit form keep it's values correct on the dropdowns, while also giving you a way to show default values in the new form. You might also try removing the items property from the duplicate and see if that fixes the server error.

I was able to restore the original dropdown boxes by deleting the data cards and creating new cards with dropdown controls. I then tried experimenting more wth the Distinct () function to try and restore the ability to have default choices for NewForm, but no luck.

Advocate I
Advocate I

Set the DefaultSelectedItems property of Dropdown control (showing Homes to the following formula:

LookUp(Choices(SharePointListOfEvents.LookupColumnForHome),Value=ListOfHomesGallery.Selected.Title)

Anonymous
Not applicable

KiranKR's response worked perfectly for me

KiranKr -- Thanks sooooo, sooo much!  This same formula did it for me after hours of searching and trying!  Really appreciate when people take the time to share their knowledge!   

Thank you. That contribution was first time in my life!

Hi KiranKr!

 

Thanks a lot for your posting! Thats the way how it works 🙂

 

Andreas

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (13,015)