cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
WinIOSAndroid
Advocate I
Advocate I

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
Meneghino
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

24 REPLIES 24
KC
Kudo Kingpin
Kudo Kingpin

Hi,

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

 

NewForm(FormNameHere)

 

Hope this helps

KC
Kudo Kingpin
Kudo Kingpin

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.

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. 

 

 

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?

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.

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.

.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?

 

 

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.

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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Check out the New Ideas Site

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (3,799)