cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Custom DropDown/ComboBox Resets on FormSubmit

I am currently building an application for a work request system. I need the application to have the ability to add a new entry as well as go into an existing entry for editing. The main app is pulling columns for SharePointList1. I then have two drop downs within the app that are pulling their items from SharePointList2 and SharePointList3. The application allows you to type in the engineer name. Then based on the engineer name, SharePointList 2 is sorted and only shows the projects aligned to that engineer (SharePointList2 has an FT_ID assigned to this combination). Upon selection of the engineer and project, SharePointList3 is then filtered based on FT_ID (unique to the engineer project combo) and lists the possible locations/accounts you can choose. When I submit the first entry into my app and click a button (named "Submit Form") I have assigned to be OnSelect --> SubmitForm(Project_Account_Info_Form), all goes well. Then I go in and add another entry with a different engineer, project name and account name from the respective drops downs. I then click my "Submit Form" button and the correct form is submitted, but the engineer, project and account drop downs reset to be what I entered in my first entry. I then do a new third entry and it saves correctly, but the dropdowns change back to the first values. Below is what I have as the code for my drops downs:

 

Engineer ComboBox:

Items --> Choices('SharePointList2'.Engineer)

Default --> nothing here, I left it blank. I tried Parent.Default but had the same issue. 

 

Project ComboBox:

Items --> 

Sort(ShowColumns(Filter('SharePointList2',Engineer.DisplayName=DataCardValue91.Selected.DisplayName),"ProjectName"),ProjectName)

Default --> nothing here, I left it blank. I tried Parent.Default but had the same issue.

 

Account ComboBox:

Items --> ShowColumns(Filter('SharePointList3',FT_ID=Value(TextInput1.Text)),"AccountName")

***TextInput1.Text Default --> LookUp('SharePointList2',Name=DataCardValue95.Selected.Name,ID)

 Default --> nothing here, I left it blank. I tried Parent.Default but had the same issue.

 

"Submit Form" Button:

OnSelect --> SubmitForm(Project_Account_Info_Form)

 

The ComboBoxes filter great and show what they are supposed to show based on the selections, but how do I get my ComboBoxes not to default to the first item in the list? Thanks!!!

2 REPLIES 2
WarrenBelz
Super User
Super User

Hi @Anonymous ,

This will cause other issues with the Update on the card (which are doable), but I use this at App OnStart

 

ClearCollect(
    colX,
    {Value: ""}
);
Collect(
    colX,
    (Choices(('SharePointList2'.Engineer))
);
ClearCollect(
    colEng,
    ShowColumns(
        colX,
        "Value"
    )
);
Clear(colX)

 

Your Items are then colEng.

If the target is a Lookup, there will however be more complex things on the update.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi @Anonymous ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,057)