cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JR-BejeweledOne
Super User
Super User

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.  

 

 

 

 

 

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
3 REPLIES 3
v-siky-msft
Community Support
Community Support

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

 

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.



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

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 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

Top Solution Authors
Top Kudoed Authors
Users online (90,428)