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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
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!

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,767)