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

count number of mandatory fields which are blank before submitting form

I have a form, in which I have six mandatory fields, however I want to be able to check if all of those fields have data entered before allowing the user to submit the form to the sharepoint list, and to display a warning dialogue box if one or more is blank.

 

I created the dialogue box, and the variable (PopUp) which will be false upon starting the screen.  Then in the submit button, I used the following formulae for the On Select property.  but there's an error and I am not sure what the error is.

 

 

UpdateContext({countmandatory: CountIf(IsBlank(DataCardValue40.text),IsBlank(Dropdown1.SelectedText),IsBlank(DropDown2.SelectedText),IsBlank(DataCardValue8.Text),IsBlank(DataCardValue28.Text),IsBlank(DataCardValue35.text))});

If(countmandatory=0,UpdateContext({PopUp:true}),UpdateContext({PopUp:false}),SubmitForm(Form1))

 

 

Wondered if anyone could assist me with the above formula (I create the other variable for the countif function in the formula and it doesn't appear anywhere else)

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@hyperbob0811 

If these are required fields in your form, then you can simply use the Valid property on the form.

If(Form1.Valid,
    SubmitForm(Form1),

    UpdateContext({PopUp:true})
)

 

I hope this is helpful for you.

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

View solution in original post

2 REPLIES 2
RandyHayes
Super User
Super User

@hyperbob0811 

If these are required fields in your form, then you can simply use the Valid property on the form.

If(Form1.Valid,
    SubmitForm(Form1),

    UpdateContext({PopUp:true})
)

 

I hope this is helpful for you.

_____________________________________________________________________________________
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!
hyperbob0811
Helper II
Helper II

@RandyHayes 

Thanks, I will try that.

 

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 (3,490)