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

Set value of TextBox (in gallery) on button click

I have a Gallery with Items.
Each Item has a Textbox associated with it.
Users can modify the values in the Textbox and submit them.

After they click submit, I wish to (re)set the values in the Textbox to some default value x.

 

How can I do that? What is the command to set 'Textbox.Value' to 'x'?

1 ACCEPTED SOLUTION

Accepted Solutions
PDiracDelta
Frequent Visitor

I have found a workaround (for default value x and Gallery definition GALLERY_DEFINITION😞

  1. On the App screen, do: OnStart=Set(ValueResetter, false);
  2. On the Submit button, do: OnSelect=Set(ValueResetter, true); Set(ValueResetter, false);
  3. On the Gallery, do: Items=If(Not ValueResetter, GALLERY_DEFINITION)
  4. On the TextBox, do: Value=If(ValueResetter, x, x)

View solution in original post

3 REPLIES 3
StalinPonnusamy
Super User
Super User

Hi @PDiracDelta 

 

Set the Default Property of TextBox to Blank() or ""

 

Thanks for responding. Two issues here:

1. I wish to set the property automatically by clicking on a button, not by actually setting a value in the interface.

2. TextBox has no Default property, only a Placeholder property. From what I learned, the Reset function exists but it only applies to objects with a Default property.

PDiracDelta
Frequent Visitor

I have found a workaround (for default value x and Gallery definition GALLERY_DEFINITION😞

  1. On the App screen, do: OnStart=Set(ValueResetter, false);
  2. On the Submit button, do: OnSelect=Set(ValueResetter, true); Set(ValueResetter, false);
  3. On the Gallery, do: Items=If(Not ValueResetter, GALLERY_DEFINITION)
  4. On the TextBox, do: Value=If(ValueResetter, x, x)

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,829)