Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 36aHUYs4SmMXy3zrDQ44g7
Power Apps - Building Power Apps
Unanswered

Reset image inside the gallery to blank, when submit button is clicked

Like (0) ShareShare
ReportReport
Posted on 18 Apr 2023 17:01:31 by 494

I have a Gallery which has a Picture control from powerapps. Need to reset the picture to blank once submit button is clicked or when new record is added in gallery when clicked on + icon. 

 

Tried to add the code Reset(AddMediaButton2)=true in Submit button, but it throws the below error.

 

Iantaylor2050_0-1681836989779.png

 

Any inputs on how to make the image blank when submit button is clicked or when + icon from top is clicked in the below screenshot. Currently even the + icon shows up the same image from the 1st row. It should show blank image when new record is added.

 

Iantaylor2050_1-1681837231112.png

 

 

 

Categories:
  • JohnM86 Profile Picture
    590 on 18 Apr 2023 at 17:33:07
    Re: Reset image inside the gallery to blank, when submit button is clicked

     

    It seems like you're trying to reset the AddMediaButton2 control using the Reset function, but that's not the correct way to reset a picture control. Instead, you can use the UpdateContext function to set the value of the picture control to blank. Here's how you can do it:

     

    1. Add a context variable to your app by clicking on the "View" tab in the left-hand pane and selecting "Variables" from the dropdown menu. Then click on "New variable" and give it a name like "ResetPicture".

    2. In your Submit button's OnSelect property, add the following code:

     

    UpdateContext({ResetPicture: true});
     
    1. In the Picture control's Image property, wrap the current formula with an If statement that checks the value of the ResetPicture variable. Here's an example:

     

    If(ResetPicture, Blank(), ThisItem.Image)
     

    This formula checks whether the ResetPicture variable is true. If it is, the formula returns Blank() which sets the picture control to a blank image. Otherwise, it returns the current image for the item.

    1. To reset the ResetPicture variable when you add a new record, add the following code to the OnSelect property of your "Add new record" button:

     

    UpdateContext({ResetPicture: false})
     

    This code sets the ResetPicture variable to false so that the picture control is not blank when you add a new record.

     

    I hope this helps!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,660 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard
Loading started