cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Reset dropdown Selected?

I have added a dropdown to a screen populated from a collection : however, if a user makes a selection, it remembers that selection whenever they return to that screen, whereas I want it to revert to the first ('dummy') item 'Select from the list...'

 

I have set 'reset' to true and tried adding a default value, but nothing seems to work.

 

When does reset kick in?

When is a default value used?

Is there another way of doing this?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Champion
Community Champion

Hi all.  At some point @flyte asked how to reset a stand alone (e.g.  drop down) control to the default value.

 

You do this by setting the Reset property of any control to a context variable, say ResetVar.

 

Then you put this code into whatever event you want to trigger the reset (e.g. a button OnSelect or a OnVisible or OnHidden etc.)

UpdateContext({ResetVar: true}); UpdateContext({ResetVar: false})

Then all of the controls with ResetVar as Reset property will be simultanaously reset to the Default value.

 

I am not sure about forms as I avoid them, I find it much easier in the end to use stand-alone controls and Patch() functions.

View solution in original post

23 REPLIES 23
Highlighted
Continued Contributor
Continued Contributor

Hi,

If have not already, reset all the form fields when a submit is succesful.

 

NewForm(FormNameHere)

 

Hope this helps

Highlighted
Continued Contributor
Continued Contributor

Sorry not thinking this early in the morning

 

Call NewForm(FormNameHere) from the screen your navigating from 

or call NewForm(FormNameHere) in the OnViisble property of the screen that contains your form.

Highlighted

What if you are not using a form. Just controls on a screen.  How do you clear the current selections on all of the controls. 

 

 

Highlighted

Any thoughts here?

 

Is one approach to create a context variable upon navigation that indicates that we want to "reset" all of the controls on a given screen to their default/initial values, and then do all of this manually within the OnVisible of the screen? 

 

This seems overkill..

 

how do we reset controls on a screen to their default / initial / un-selected states?

Highlighted

Your best bet would be to make a form just for the purpose of being able to call the NewForm() on it and reset the controls. You could include a button on the page to do this, or if you want it to happen every time you traverse to the page you could put it as part of the screen's OnVisible() event.

Highlighted

Just thought about this as well, since forms have to have a data source to work properly.

 

FOr the data property of the form, put ["form"]. This creates a "datasource" and allows you to make custom cards on said form, which in turn allow you to perform the NewForm() reset to it as well.

Highlighted

.ok...

 

So have a look at the Employee Engagement Survey template. There are no forms used. At the end of the survey, convieniently there isn't a "Start New Survey" button. How would one restart this survey, and thus resetting all of the previous selections?

 

 

Highlighted

I don't think it is a matter of convenience that you can't restart the survey. Generally you would only want one survey entry per person. In fact, the submit button has a ton of functions in there that seem to check if the person has already made a response to handle that. Going backa nd forth between screens after clicking an answer doesn't reset them either.

 

The Emplyee Engagement app is nothing more than different screens with different types of input that use back and next buttons to navigate to the prior and next screen, respectively. It was made to show you how to make those things work within powerapps. There would be no need for a reset of the inputs for this app.

 

Having said that, the only workaround I can see without directly "resetting" all of the inputs (which doesnt seem to be possible) is to place what you want reset into a faux form and use its built-in NewForm() function to do wht you need. I know it is a bit of a hack (M$ if you have a better answer please chime in!) but it would work with minimal extra time.

 

Beleive me they have left a lot to be desired for app creation within powerapps, and I hope what you ask for is coming soon.

Highlighted

to be more precise, the app actually decides to either make a new entry in the DB or patch the entry already created when you click submit.

 

So much for creating a fully functioning app without writing code.... 😛

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (10,890)