cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
abd3127 Kudo Kingpin
Kudo Kingpin

Using validations on a form

Hello Guys,

 

I have a sharepoint list with 20+ columns, and i am using forms for these columns. 

I have created more than 2 screens and using below formula

Patch(DataSource, Item_Being_Edited, Form1.Updates, Form2.Updates, Form3.Updates).

This query saves the data perfectly in the list.

But while saving the data, it does not give validation error even if one of my field is blank (when using "SubmitForm()" function it gives validation error)

Is there any way to achieve this using forms those are on more than 2-3 screens?

8 REPLIES 8
Community Support
Community Support

Re: Using validations on a form

Hi @abd3127,

 

What did you mean by it give validation error if one field is blank. If the fields are not marked as required from SharePoint list, then when you submit the record from PowerApps, even if this field is empty, there will be no error. 

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
bdodu Responsive Resident
Responsive Resident

Re: Using validations on a form

I thing you should read the following 2 links:

 

A Few Best Practices In Data Validation

 

Validate Function

Super User
Super User

Re: Using validations on a form

Try this video on powerapps conditional formatting. You will need to implement some of these concepts. 

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training
Highlighted
Super User
Super User

Re: Using validations on a form

Hello @abd3127. Be sure to use the "Required" property for data cards that you want to flag. This should prevent user from submitting a form that has missing fields. 

  • Click the data card
  • Select "Required" from the top left Properties dropdown
  • Change from "false" to "true"

Now when user submits form, if the field is blank, it won't allow form to be submitted until user adds a value. 

 

PRO TIP: Don't delete the "error message" and "star" controls from the default data card. It defeats much of the above solution. 

 

Hope this helps. 

abd3127 Kudo Kingpin
Kudo Kingpin

Re: Using validations on a form

hello @v-monli-msft @ericonline @Shanescows@bdodu

 

I am using form which is spanned on 3 screens.

I know that if a form is present on only 1 screen then we can use "Submit form" for the validations.

Right now as my form is on 3 screns and i am using patch function with form1.updates, i am not getting the default validation

 

Super User
Super User

Re: Using validations on a form

You might consider creating a single-screen app and controlling the form fields with Visibility instead of having 3 separate screens. I recently did this with an 80+ field form and it works great.

Gaëlle Helper V
Helper V

Re: Using validations on a form

Hi @abd3127 , @Audrie-MSFT 

 

I am really curious on how to make the Validate function work with patching new records...

So, when you wrote 

Validate(DataSource,Item_Being_Updated;Form1.Update)

I have to ask you how did you get the Item_Being_Updated ?

 

I mean, for a creation of a record, I obviously can't write "Lookup(MyDataSource,Id=IdDataCard.Text)"

 

Yhanks for giving me a hand 😉

Super User
Super User

Re: Using validations on a form

Hi @abd3127 

You could consider checking if the forms are valid before submitting. If a card is required but doesn't have a value, the card's value for valid is false which in turn rolls up to the form which will also have a valid of false.

 

EditForm1.Valid

Please check below video that shows how .Valid can be used.

https://youtu.be/7O8HCz37Q0A

 

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 mark this as the answer to close the topic and make it easier to find for other people with similar questions.

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Top Solution Authors
Top Kudoed Authors
Users online (7,717)