cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Prodigy
Post Prodigy

Navigating to new screen clears selected values

I am having the strangest issue in my new app.

 

When running the app live, values that are selected in the Dropdown controls are lost when navigating to the next screen, however

it does NOT happen when editing the app and running in preview mode.  The text input controls are not affected nor is the date picker.  Only the values in the Dropdown controls are affected.  The Dropdown controls are getting their data from an external data source (SharePoint List)

 

Nothing has been set in the onHidden or onVisible and the navigation icon to the next screen only has the navigation formula.  

 

 

 

 

 

 

3 REPLIES 3
Highlighted
Community Support
Community Support

Re: Navigating to new screen clears selected values

Hi @JR-BejeweledOne ,

 

Could you please share more details about your scenario? How is the selected value passed?

We need more information(codes, screenshots) to reproduce and diagnose your issue.

In general, you can pass the dropdown selection value by storing into a global variable.

Please try to set the OnChange property of dropdown as follows, 

Set(VarItem, DropdownName.Selected.Value)

Hope this helps.

Sik

 

Highlighted
Post Prodigy
Post Prodigy

Re: Navigating to new screen clears selected values

Well it seems that I have resolved it but the resolution is very strange.

 

I originally had the 'AllowEmptySelection' attribute set to true for all the dropdowns.   I was working with it this morning and changed the 'AllowEmptySelection' to false.   Now it is working properly and none of the dropdowns are losing their value when switching to the next screen.

 

Turns out that once I navigate more than one screen away the values are again lost, so it looks like Global variables will have to be used.

 

It still makes absolutely no sense whatsoever that it works in Preview but not live.

Highlighted
Post Prodigy
Post Prodigy

Re: Navigating to new screen clears selected values

So in trying to mitigate this issue for the people using the app (in the event they need to navigate back to the screen), I set the onChange event to set a variable to the value of the selection made in the dropdown and then added a label to display that value.

 

After testing that it got me thinking that this should not be normal behavior and here is why.

 

Logic would say that if the value in the dropdown changes (regardless of HOW it changes) that the variable would also reflect that change as it is set on the onChange event NOT the onSelect event.

 

That is not happening.   The variable is retaining the originally selected value.  When go through the app 'live', if I navigate back to the screen where these dropdowns are located, I see the values for a brief second before they disappear.   Once they disappear the star icons are then visible and the navigation button to go to the next screen is disabled but the variables still contain the original value.   Note:  I have tested this with the 'AllowEmptySelection' set to true and to false.  The behavior is the same regardless.   Even if it's set to false, when navigating back to that screen the dropdowns are empty.

 

I am also emulating required fields with the use of star icons and visibility formulas.   These are displayed or hidden based on IsEmpty(dropdownName).  As you can see in this first image, the star icons are not visible because the dropdown controls are not blank.

 

PreNavigate.png

 

1.  Default Value: "",  Items: Filter(Data, DataType.Value = "Phase")

2. OnChange: Set(varPhase, DropdownPhase.Selected.Title)

3. Notice that the mode on the navigation icon is Visible (this is because none of the star icons are visible)

 

This next image is what you see after navigating to other screens and then navigating back to this screen.

 

BackNavigate.png

 

4. Dropdown Fields are now blank, Star icon is visible.

   a.  StarIcon visible: If(IsBlank(DropdownPhase), true)

   b.  Variable did not change value when the dropdown changed.   As you can see in the label next to the dropdown field (text =     varPhase).

5. Because the Star icons are visible now, the navigation to the next screen is now Disabled.

 

Plot twist:   If I set the default value of the dropdown to be the associated variable and then need to navigate back to that screen the value stays as it should.

 

2nd Plot twist:  If I navigate back to the screen and choose a value in each dropdown a second time (even a different value) and then navigate to the next screen or the screen after and make additional changes, and then navigate back to the screen with the dropdowns, the values are retained unlike navigating back the first time.

 

@Shanescows 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,741)