cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Submit form, navigate to a Thank you screen

HiI am trying to do a very basic thing but I am stuck and I cant find the answer anywhere.
I have created a form from a list in Sharepoint:

I have added a button that I would like to do the following:

  1. Form is filled in (SharePointForm1)
  2. Click Submit (my button)
  3. Form disappears
  4. New screen shows up (and you should not be able to see the List) (ThankYouScreen)

On the Button I have added this is OnSelect:
if(VarCurrentMode,"New",SubmitForm(SharePointForm1);Navigate(ThankYouScreen),ScreenTransition.Fade),SubmitForm(SharePointForm1)) 

On the SharePointForm1 I have added in OnSuccess:
ResetForm( Self );
If(
varSave,
( SharePointForm1 ),
RequestHide()
)

Any ideas? Very greatful to any good ideas! 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@Anonymous 

Yes, I had not provided the "next step" on closing the form - that is why you see an empty form.

 

For your questions...

1. When a mandatory field is not filled in, stay on the screen (or even better, get a notice that something is missing)  -  This IS part of what a form provides.  It has a Valid property to let you know if the form is valid and complete.


2. If it is entered correctly, you should end up on the ThankYouScreen 

Actually...you should be saying "if it is submitted correctly"!  Yes, this is what the OnSuccess is for.

 

However, you should consider one thing about SharePoint integration.  

The default buttons of Cancel and Save WILL still be there.

If you provide yet another "Submit" button in your app, then this becomes very confusing for users.  AND, they can quickly decide to use one over the other.

 

So, you need to decide up front - will you implement the logic in the OnSave action of the SharePoint Integration, or will you want to avoid it?  If you want to avoid it, then the standard method is to provide a notification to the user that they should click on YOUR button in the app and not the Save button if they should click on the standard save button in SharePoint.

 

Now...back to what you have implemented.  If you had the Navigate function in your OnSuccess, then you should have see the Thank You screen when you submitted - not the same form screen and now blank.

 

But, let me know what your choice is on the above question on the save/submit functionality.

_____________________________________________________________________________________
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!

View solution in original post

14 REPLIES 14
theapurva
Super User
Super User

Correcting some Syntactical error in your formula, try as below:

If(VarCurrentMode=FormMode.New,SubmitForm(SharePointForm1);Navigate(ThankYouScreen,ScreenTransition.Fade),SubmitForm(SharePointForm1)) 



-----------------------------------------------------------------------------------
Liked My Solution? Click on the Thumbs Up below.
Did I answer your Question? Please Click Accept as Solution below

Want to Support me? Buy Me A Coffee
RandyHayes
Super User
Super User

@Anonymous 

You never want to navigate immediately after your SubmitForm in your formula!!

There is no guarantee that the form submitted properly and, if you navigate away, the user will never know and your data will be lost.

 

Instead, change your formula to the following:

SubmitForm(SharePointForm1)

 

Then, perform any logic in your OnSuccess...including the Navigate function.

I would provide a suggestion on that entire formula, but your provided formula is not accurate, so I will simply say...add your navigate there.

 

I hope this is helpful for you.

_____________________________________________________________________________________
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!
Anonymous
Not applicable

Thank you very much for you answer, but it didnt work unfortunately. I added the formula you provided but now nothing happens instead? Any new idea? 

 

Anonymous
Not applicable

Thanks, and you mean I should put it into SharePointForm1? 

Anonymous
Not applicable

Pims_0-1664289605422.png

This is how it looks, I guess the ThankYouScreen marked red should tell me something....? 

theapurva
Super User
Super User

Hello @Anonymous:

as per screenshot, issue is with varCurrentmode, How are you setting varCurrentmode variable value?

Please paste code here.

 

You can try below:

If(VarCurrentMode="New",SubmitForm(SharePointForm1);Navigate(ThankYouScreen,ScreenTransition.Fade),SubmitForm(SharePointForm1)) 
-----------------------------------------------------------------------------------
Liked My Solution? Click on the Thumbs Up below.
Did I answer your Question? Please Click Accept as Solution below

Want to Support me? Buy Me A Coffee

@Anonymous 

Yes, you should have the formula I mentioned in your OnSuccess action formula of your form...if that is SharePointForm1, then that is the place.

 

You really need NO logic in your Submit action because BOTH the true and the false of your variable condition would result in a SubmitForm...so why even bother?

 

Simply do the other check you want in the OnSuccess and then navigate as needed.

_____________________________________________________________________________________
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!
Anonymous
Not applicable

I see, thanks! Sorry, I am really a newbie so if you have a complete other formula that can do the magic instead 🙂 

RandyHayes
Super User
Super User

@Anonymous 

Have you tried what I mentioned?  If you're a newbie to PowerApps - the one thing you want to start to learn immediately is that you do NOT want to navigate in the Same formula as the SubmitForm.

 

SubmitForm "starts" at the point that the function is encountered in the formula.  BUT, it does not "wait" until it is complete!!  It moves on to the next function in the formula.

So, there is NO guarantee that the submit form has completed by the time it gets to your navigate.  And, if you navigate prior to the completion, you risk losing data and frustrating users!

THIS is why there is an OnSuccess action (and OnFailure) on the form - to provide you a place to have operations occur when it is a success.

_____________________________________________________________________________________
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!

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 (3,303)