cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KevinHardy
Level 8

Reset Form on save

Hi,

I have a save button to submit my form which includes an image taken by the camera. My issue is that when you return to the form the old image is still there and I need it to reset. I have tried:   SubmitForm(FormNewExpense) & ResetForm(FormNewExpense)

But this is not working.

 

Any suggestions?

1 ACCEPTED SOLUTION

Accepted Solutions
KevinHardy
Level 8

Re: Reset Form on save

Update. After searching the forums for anything useful I stumbled on to a post from @JRaasumaa  in 2017 that looked promising - and turned out to be the perfect answer - achieving the 'hide the cached image box' until the user clicked the camera but without the wired 'getting your data' screen I kept getting with my dodgy coding 🙂

 

I don't know how to link to other posts so I've copied and pasted it below. So thank you @JRaasumaa 

 

To have the box start off invisible and show up on button press:

 

1. Create the Text box as a label.

2. Insert the name in the text box

3. Selected the text box and set upper left to "Visible" and the function is as follows: 

If(VisibleVar=true,true,false)

4. Select the screen and then change the upper left to "OnVisibile" and the function is as follows:

UpdateContext({VisibleVar:false})

5. Select the Button and change the upper left to OnSelect: 

UpdateContext({VisibleVar:true})

6. Navigate away from the screen and back. Upon being visible it will set the VisibleVar to false, leaving your text box hidden. Pressing the button will then change VisibleVar to true showing the text box. 

 

To make the box visible on screen load and then disappear on click simply reverse the #3 step true/false

If(VisibleVar=true,false,true)

(or reverse on-load to false and onselect to true, your choice)

View solution in original post

5 REPLIES 5
KevinHardy
Level 8

Re: Reset Form on save

After a lot of internet trawling, it appears there is no way to clear the cached image - which seems rather ridiuclous to me. Perhaps this will be available in the future?

 

As a work around I wonder if it is possible to change the visibility of the image box until the user has clicked the camera image? This would hopefully then hide the image box that stills holds the last image until it has been refreshed. Does anyone know if this is possible or, even better, how I might achieve it?

Community Support Team
Community Support Team

Re: Reset Form on save

Hi @KevinHardy ,

Could you tell me 

1)what do you want to do by using this form, edit an existing record or create a new record?

2)what control do you use to update the captured image? what formula do you use to display the image?

 

I assume that you use an imge control to display the captured image.

If so, the image that the control displays is determined by its Image property.

If you want the image control diaplying nothing, you need to clear its Image property.

So I suggest you set the submit button's OnSuccess: 

Set(var,true)

Then set the imge control's Image:

If(var,"",Camera1.Photo)

 

 

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.
KevinHardy
Level 8

Re: Reset Form on save

@v-yutliu-msft 

 

I've attached a screenshot of the form. It creates a new record.

I'm using the camera (Camera1) within a datacard to take a picture which is then stored in the right hand box as Camera1.Photo - This is the image box that does not clear the cached image the next time you visit the screen.

 

As regards your suggestion of adding code to the OnSuccess of the Submit Button - I can't see where to put this. OnSUccess does not appear on any of the buttons options.

KevinHardy
Level 8

Re: Reset Form on save

I thought I had found a workaround by making the ImageData box invisible until Camera1 had been clicked - this does work and achieves the desired effect as it effectively hides the cached image until a new one has been created.

However, when you then try to return to the screen everything but the form appears along with a message 'Getting your data' which never changes until you press the back button, when the whole screen flashes up before returning to the 'Home' screen.

Any ideas why this is happening?

KevinHardy
Level 8

Re: Reset Form on save

Update. After searching the forums for anything useful I stumbled on to a post from @JRaasumaa  in 2017 that looked promising - and turned out to be the perfect answer - achieving the 'hide the cached image box' until the user clicked the camera but without the wired 'getting your data' screen I kept getting with my dodgy coding 🙂

 

I don't know how to link to other posts so I've copied and pasted it below. So thank you @JRaasumaa 

 

To have the box start off invisible and show up on button press:

 

1. Create the Text box as a label.

2. Insert the name in the text box

3. Selected the text box and set upper left to "Visible" and the function is as follows: 

If(VisibleVar=true,true,false)

4. Select the screen and then change the upper left to "OnVisibile" and the function is as follows:

UpdateContext({VisibleVar:false})

5. Select the Button and change the upper left to OnSelect: 

UpdateContext({VisibleVar:true})

6. Navigate away from the screen and back. Upon being visible it will set the VisibleVar to false, leaving your text box hidden. Pressing the button will then change VisibleVar to true showing the text box. 

 

To make the box visible on screen load and then disappear on click simply reverse the #3 step true/false

If(VisibleVar=true,false,true)

(or reverse on-load to false and onselect to true, your choice)

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,755)