cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ashok2
Post Patron
Post Patron

validation of forms in powerapps

I am trying to validate form onsuccess but its not working for patch updates it only work on submit forms

Form2,updates is the form where validation is required 

 

Patch(SPlist, SelectedItem, Form_1.Updates, Form2.Updates,Form3.Updates);

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @Ashok2 ,

Currently, within PowerApps app, the Form validation mechanism only work when you use SubmitForm function to submit form data, it would not work for Patch function.

 

In addition, based on the formula that you mentioned, I think there is something wrong with it. Please consider modify your formula as below:

If(
    IsEmpty(
            Errors(
                    SPlist,  // Modify here. Specify your SP List data source here
                    Patch(SPlist, SelectedItem, Form_1.Updates, Form2.Updates, Form3.Updates)
            )
    ),
    ResetForm(Form_1);ResetForm(Form2);ResetForm(Form3);Back(),
    Notify("There is something wrong when you submit form data" & First(Errors(SPlist)).Message, NotificationType.Error)
)

 

Please take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
WarrenBelz
Super User III
Super User III

Hi @Ashok2 ,

Have a read of this post - it may resolve your issue.

 

 

Please click and accept as Solution if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.

Tried below syntax but getting error

 

If(
IsEmpty(
Errors(
Patch(SPlist, SelectedItem, Form_1.Updates, Form2.Updates,Form3.Updates);
)
)
)

Hi @Ashok2 ,

The Errors function needs to be used after the patch - you need to check on the result of the Patch after it has been applied.

 

Please click and accept as Solution if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.

v-xida-msft
Community Support
Community Support

Hi @Ashok2 ,

Currently, within PowerApps app, the Form validation mechanism only work when you use SubmitForm function to submit form data, it would not work for Patch function.

 

In addition, based on the formula that you mentioned, I think there is something wrong with it. Please consider modify your formula as below:

If(
    IsEmpty(
            Errors(
                    SPlist,  // Modify here. Specify your SP List data source here
                    Patch(SPlist, SelectedItem, Form_1.Updates, Form2.Updates, Form3.Updates)
            )
    ),
    ResetForm(Form_1);ResetForm(Form2);ResetForm(Form3);Back(),
    Notify("There is something wrong when you submit form data" & First(Errors(SPlist)).Message, NotificationType.Error)
)

 

Please take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

DavesTechTips
Super User
Super User

Hi @Ashok2 ,

Please note that the Submitform will work exactly like a patch, but if there are not changes to update, it won't send any data to the server which is quite cool.

 

Below is a method that we are using for form validation that is very easy to implement and works very well.

 

Let me know if you don't come right.

https://powerusers.microsoft.com/t5/Webinars-and-Video-Gallery/Microsoft-PowerApps-Form-Validation/m...

 

Dawid van Heerden
Follow on Twitter: @davestechtips
Subscribe to YouTube: https://www.youtube.com/davestechtips?sub_confirmation=1
**If you found this reply helpful, please like it and mark this as the answer to close the topic and make it easier to find for other people with similar questions.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (43,158)