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

Dropdown Resetting to Default Value on Submit

I am looking to save the dropdown selection from a gallery, which has a repeating functionality. Users select either "Positive" (the default selection) or "Negative."When I hit "save," it should update my list with the user inputs. However, when I selected "Negative" and then hit save, it immediately defaults back to "Positive." Any ideas? Thanks! 

engineer28_1-1623083755879.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@Anonymous 

Very good.  Sounds like forward progress.

Now, just change your OnSuccess action of your form to the following:

Collect(
   ISPFLLNegative,
   ForAll(
       Filter(InputCollection, !IsBlank(MultiLineProblem)),
       {Title: MultiLineProblem,
        'Recommended Solution': MultiLineSolution,
        MasterID: Self.LastSubmit.ID,
        PN: ChoicePN
       }
   )
)

In your previous formula (beside the ForAll being backward) you were using the value of the Dropdown1 from the screen...not your collection.  So you would have only gotten the selection from the first row in your gallery into all records created.

The above formula will give you what you need.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

19 REPLIES 19
RandyHayes
Super User
Super User

@Anonymous 

Is there any particular reason that you have an EditForm and are using Patch to submit it rather than SubmitForm?

You should only be doing a SubmitForm on the form, otherwise you will have unpredictable results as you are seeing.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Anonymous
Not applicable

It is not a form but a gallery functioning as a repeating table of sorts, allowing for multiple imputs that are all connected to a form. (The title, product, etc. you see at the top of the screenshot). 

RandyHayes
Super User
Super User

@Anonymous 

Thanks for the clarification.  It all looked like a form 😉

 

So, the above is a form though - is this information to be submitted in the record of the form or are the contents of this Gallery going some place else?

 

As for the dropdown that you were dealing with - what is the Default property of that control in your gallery?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Anonymous
Not applicable

The contents of the form and gallery go to two separate lists (but are tied together with a MasterID number). The idea is that the user can input multiple comments (via the gallery) for one project (the form). 

 

As for the dropdown, the default property is "1"

RandyHayes
Super User
Super User

@Anonymous 

Well, as for the Default property...there is your issue.  You don't have it set to anything.  It needs to be the underlying record value for it to "retain".

Set the Default to : ThisItem.ChoicePN.Value

 

In your OnSuccess of the editform, the following formula:

Collect(yourOtherDataSourceName,
    AddColumns(Filter(InputCollection, !IsBlank(MultiLineProblem)),
        "yourMasterIDColumnName", Self.LastSubmit.ID
    )
)

 

The above formula implies a couple of things:

1) That all of the items in your gallery (problem, solution, choice) must be completed and you have already accounted for this when adding to the collection - so, the above filter will get rid of any rows that don't have a problem filled in (i.e. your blank row).

2) That the names of your columns (MultiLineProblem, etc) in your collection match EXACTLY the real names of the columns in your list.

3) That the ChoicePN column in your list is a text column and not a Choices column

 

If any of the above implications are not correct, please let me know which and what is different.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Anonymous
Not applicable

Changing the default property did not make a difference. 

As far as assumptions, assumptions 1&2 are correct but 3 is not. My ChoicesPN column is a Choices column

RandyHayes
Super User
Super User

@Anonymous 

Yes, this was why #3 was important.  You are saving the text value of the record to your underlying collection.

So, If it is a choice, then you need to change the formula you have for the save icon to the following:

Patch(InputCollection, ThisItem, 
    {MultiLineProblem: inputProblem.Text, 
     MultiLineSolution: inputSolution.Text,
     ChoicePN: Dropdown1.Selected
    }
);
Collect(InputCollection, 
    {MultiLineProblem: "", 
     MultiLineSolution: "",
     ChoicePN: {Value:""}
    }
)

 Default on the dropdown should remain as : ThisItem.ChoicePN.Value

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Anonymous
Not applicable

Unfortunately it is still switching to positive

RandyHayes
Super User
Super User

@Anonymous 

Then your underlying collection is not getting updated properly.  Can you look at the collection viewer and see what it is capturing?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,150)