cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
IntraAdmin
Helper II
Helper II

If(Form(HREdit).Valid, Submit(HREdit)) running OnSuccess even if Required field is blank

I have canvas app with a SharePoint list as a data source.  I have a field called Traveling that is required if the FormMode = New is true and EmpType = Contractor/StaffAug else it is only required if HREdit.Mode = New is false.  The following is the formula in Traveling.Required:

 

If(
    HREdit.Mode = New,
    If(
        EmpTypeDataCardValue18.Selected.Value = "Contractor/Staff Aug",
        true,false
    ),
    true
)

 

The formula in the Submit button OnSelect property is as follows:

If(HREdit.Valid,SubmitForm(HREdit))

 The OnSuccess property of the HREdit form is as follows:

Reset(txtSearch);Navigate(Gallery2,None);Set(varResetDir,true);Refresh(Onboarding)

 

When testing the app, the OnSuccess property of the HREdit form seems to run sending the user to the Gallery and displaying the required field error at the top of the gallery.  Why is the form submitting if the form is not valid?  The Traveling field is a dropdown choice field and not a combo box.

 

Thank you in advance.

10 REPLIES 10
RandyHayes
Super User
Super User

@IntraAdmin

You don't need all the redundant true false statements with an If, the following formula will already return a true or false:

(Parent.Mode=FormMode.New && EmpTypeDataCardValue18.Selected.Value="Contractor/StaffAug") || !(Parent.Mode=FormMode.New)

 

Next... the question is, what is your Update property?

 

Keep in mind that if the Update has ANY value and the datacard is marked as required, then it is Valid.

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

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

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 (1,623)