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

Errors on Concurrent Form Submittals

Hello,

 

What is the best way to have two forms only submit if there are no blanks in either?

 

OnSelect = SubmitForm(FormA); SubmitForm(FormB)

or

OnSelect = Concurrent(SubmitForm(FormA), SubmitForm(FormB))

 

FormB is only required if one of the values in FormA equals yes, but I don't want FormA to be submitted if FormB is missing a field that needs to be fixed.

 

If there is a field missing a value in FormB, will the CONCURRENT still submit FormA or will it reject it and require FormB to be fixed before the concurrent will submit?

1 ACCEPTED SOLUTION

Accepted Solutions
DTreg1
Level 8

Re: Errors on Concurrent Form Submittals

4 REPLIES 4
Super User
Super User

Re: Errors on Concurrent Form Submittals

Using Concurrent simply means that the Forms are submtted in parallel threads instead of one after the other.  Neither of your formula will prevent the forms from being submitted.  To do this one I recommend creating a variable for each form and set the value based on whether the forms contain any blank fields or not.  Then you can use an if() on the function to only submit the forms if both variables are True.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
DTreg1
Level 8

Re: Errors on Concurrent Form Submittals

I don't believe that solution would allow me to display the red box errors that I need to have shown so the user knows what to fix. It just wouldn't do anything right?

 

I know there's an IfError() function but I can't really figure out how I would use it in this scenario or even in the examples on the blog page.

DTreg1
Level 8

Re: Errors on Concurrent Form Submittals

Super User
Super User

Re: Errors on Concurrent Form Submittals

Its essentially the same solution I am suggesting.  The only difference is that instead of putting all the If logic in the OnSelect property of the button I add it to each control and store the result in a variable.  That makes the OnSelect statement easier to read. Remember in the article there are only 4 text boxes involved.  Imagine what the OnSelect formula looks like if there are 20-30 controls on the form?  You need an IsEmpty clause in the OnSelect for each control and you have to modify the whole thing every time you add a control to the page.  I'm suggesting that the OnVisible for the screen or the OnStart for the App is set to this:

Set(submitOK,0)

and the OnChange of each input control be set to this

If(IsBlank(TextInput2.Text),Set(submitOK,submitOK+1),Set(submitOK,submitOK-1))

and then the DisplayMode for the submit looks like this:

If(submitOK > 0,DisplayMode.Disabled,DisplayMode.Edit)

You can use similar code for the Visible property of an error lablel. The submit doesn't change whether you have 1 control or 50.  It does require extra work to implement each control. Both solutions will work, but I think this way is more extensible for larger forms.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 50 members 4,680 guests
Please welcome our newest community members: