cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rknight
Helper II
Helper II

All Text Inputs in Gallery Resetting - They Shouldn't Be

I have a Gallery containing items from a SharePoint list that you can check. When they are checked, the input comes up to add a quantity. You can check multiple items and set a quantity for each. See screenshot below.

rknight_0-1636483835301.png

The code for the checkbox and text input are as follows for the different aspects.

Checkbox

OnCheck: 

 

true;Set(ResetAllCheckboxes,false);Collect(CheckedItems,{
    Item:Checkbox1.Text,
    Quantity: 0,
    Price: Text(ThisItem.Price,"[$-en-US]$ ###.00")
})

 

OnUncheck:

 

false;
Remove(AllItems,First(Filter(CheckedItems,Item=Checkbox1.Text)));
Remove(CheckedItems,First(Filter(CheckedItems,Item=Checkbox1.Text)));
Set(_reset,true)

 

Reset:

 

ResetAllCheckboxes

 

Text Input:

Default: ""

OnChange:

 

Set(_reset,false);
UpdateIf(CheckedItems,Item=Checkbox1.Text,{
    Quantity:Value(TextInput1.Text)
    })

 

Reset: 

 

_reset

 

 

Now, for some reason, when unchecking any item, it resets all of the text input boxes. See screenshot.

rknight_1-1636484230042.png

Any assistance would be greatly appreciated!

 

@RandyHayes - You've always been a huge help. Figured I'd tag you.

1 ACCEPTED SOLUTION

Accepted Solutions
rknight
Helper II
Helper II

I fixed it! 

Instead of using a _reset variable, I used the Reset function on the Uncheck property of the checkbox. 

Reset(TextInput1)

That worked like a charm.

Thanks for your help, Randy!

View solution in original post

4 REPLIES 4
RandyHayes
Super User
Super User

@rknight 

So the big question is...what is the Default property of the Text box??  That will govern what is shown in it.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

""

So I'm guessing I need to adjust that be a dynamic value?

Just not sure what that value should be...

I tried just having it blank, but no dice. 

I also tried moving the DisplayMode change to the checkbox OnCheck/Uncheck properties from the input visibility property. Still no dice.

rknight
Helper II
Helper II

I fixed it! 

Instead of using a _reset variable, I used the Reset function on the Uncheck property of the checkbox. 

Reset(TextInput1)

That worked like a charm.

Thanks for your help, Randy!

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,049)