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

Reset all input fields to default after creating a collection with them

Hello everyone,

I am building an app which creates a collection with the following input fields: Textboxes, Datepicker, Checkboxes, Dropdowns.

The Problem is, after I built the collection (using a button) the values in the input fields won't reset to their default value.

So when I want to write a new collection, I always have to delete the old entries I did before.

Do you know any "OnClick Set Default(Checkbox1.Value), Default(Textbox1.Text),....." command?

Please let me know.

Thanks for your help.

1 ACCEPTED SOLUTION

Accepted Solutions
mdevaney
Super User III
Super User III

@Anonymous 

Put this code in the OnSelect property of your button.

Set(resetInputFields, true); Set(resetInputFields, false);

 

Then put this variable in the Reset property of all your input fields.

resetInputFields

 

Now when you click the button they will all reset to whatever value is in their default property

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

View solution in original post

2 REPLIES 2
mdevaney
Super User III
Super User III

@Anonymous 

Put this code in the OnSelect property of your button.

Set(resetInputFields, true); Set(resetInputFields, false);

 

Then put this variable in the Reset property of all your input fields.

resetInputFields

 

Now when you click the button they will all reset to whatever value is in their default property

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

View solution in original post

v-yutliu-msft
Community Support
Community Support

Hi  @Anonymous ,

Do you want to reset all input fields to default after creating a collection (using a button)?

It can be easily implemented by using Reset() function. Ive made a similar test for your reference:

Step1:Add a TextInput control(TextInput1);

Step2:Add a DatePicker control(DatePicker1)

Step3:Add a CheckBox control(CheckBox)

Step4:add a DropDown control(DropDown2)

Step5: add a Button control(SUBMIT) and set its OnSelect property to:

Collect(

    Demo,

    {

        Text: TextInput1.Text,

        Date: DatePicker1.SelectedDate,

        Check: Checkbox1.Value,

        Dropdowns: Dropdown2.SelectedText.Value

    }

);

Reset(TextInput1);

Reset(DatePicker1);

Reset(Checkbox1);

Reset(Dropdown2);

If you still have any question please dont hesitate to let us know.

 

 

Best Regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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

secondImage

Demo Extravaganza is Back!

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

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (44,261)