What is the best way to have two forms only submit if there are no blanks in either?
OnSelect = SubmitForm(FormA); SubmitForm(FormB)
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?
Solved! Go to Solution.
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.
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.
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:
and the OnChange of each input control be set to this
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.
Continue your learning in our online communities.
Features releasing from October 2019 through March 2020
Coming to a city near you
Fill out a quick form to claim your user group badge now!
Connect, share, and learn with your peers year-round
Register by September 5 to save $200