Reputation: 397
I have a Sharepoint online list with fields Sun, Mon and RatePerJob. The RatePerJob is mandatory. Either Sun or Mon must have a value. All fields are numeric. In the list settings I have this validation formula.
=AND(AND(RatePerJob>0,RatePerJob<50),OR(Sun>0,Mon>0))
I have a powerapp with a gallery and form linked to the Sharepoint list. I want to avoid having to write lots of validation code in the powerapp. How can I use the validate function in powerapps to submit the form if it's valid and to display an error message otherwise?
Upvotes: 0
Views: 953
Reputation: 411
Set the OnSelect property of the button as shown below:
If(Value(DataCardValue4.Text)>0 And Value(DataCardValue4.Text)<50 And (Value(DataCardValue2.Text)>0 Or Value(DataCardValue3.Text)>0),
SubmitForm(Form1),
Notify("ErrorTest", NotificationType.Error)
)
Note,DataCardValue4 is the datacard of RatePerJob column, DataCardValue2 and DataCardValue3 are the datacards in the Sun and Mon columns respectively.
You could also change the related datacard name more user friendly.
Upvotes: 1