web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Validate all the requi...
Power Apps
Unanswered

Validate all the required field before submitting a form.

(0) ShareShare
ReportReport
Posted on by 27

I have two forms. They are both connected to different data sources. 

- form 1 is on screen 1

- form 2 is on screen 2

 

On-screen 1, I just want to validate the fields and upon successfully validating the field, I want to navigate to screen 2 (Not submitting form 1). Also, I would like to show all the empty fields just like below:

yashp1196_2-1690495198634.png

 

On-screen 2, I would like to validate form 2 and upon validating, submit form 1 and form 2 together.  

---------------

form 1 is on screen 1

 

yashp1196_0-1690494921389.png

 

form 2 is on screen 2

yashp1196_1-1690494956554.png

 

Categories:
I have the same question (0)
  • v-jefferni Profile Picture
    on at

    Hi @yashp1196 ,

     

    You can simply leverage the Valid property of the Forms:

    vjefferni_0-1690513661573.png

     

    So, you can navigate and submit form based on whether each form is valid.

    If(Form1.Valid, Navigate(Screen2), Notify(...))

    If(Form1.Valid && Form2.Valid, SubmitForm(Form1), SubmitForm(Form2))

     

    Best regards,

  • yashp1196 Profile Picture
    27 on at

    Form1.valid does not give you the below validation. What I am looking for is showing all the red borders and red messages.

    yashp1196_0-1690565295415.png

     

  • v-jefferni Profile Picture
    on at

    Hi @yashp1196 ,

     

    Since borders and error messages will come up only when you submit the form, you can validate the form first, if it's valid then navigate to screen2, if not, submit form to call out the error message.

     

    OnSelect of the Next button:

    If(EditForm1.Valid, Navigate(Screen2), SubmitForm(EditForm1))

     

    on screen2, validate the form2 first, if it is valid then submit the two forms. But if it's not valid, submit form2 to call out the errors:

    If(Form2.Valid, SubmitForm(Form1);SubmitForm(Form2), SubmitForm(Form2))

     

    Best regards,

     

  • yashp1196 Profile Picture
    27 on at

    Thats a good idea @v-jefferni , but i do not want to submit the form on screen 1, because what if the users wants to go back from screen 2 to 1 to fix something. 

  • Verified answer
    v-jefferni Profile Picture
    on at

    Hi @yashp1196 ,

     

    If not using SubmitForm to validate the form, you will have to set as many variables as the number of Data Cards, validate the form and determine whether navigating to the other screen on the Form's Valid property. If the Form is not valid, it means that there are empty fields in the form. Then Color of controls and Visible of error message Labels will change based on respective variables.

    If(Form1.Valid, Navigate(Screen2),UpdateContext({DC1: DataCard1.Valid, DC2: DataCard2.Valid, DC3: DataCard3.Valid, ...})

     

    Visible of error message Label in Data Card 1

    !DC1

    Data Card 2

    !DC2

    and so on.

     

    BorderColor of DataCardValue1

    If(DC1, Parent.BorderColor, Color.Red)

    BorderColor of DataCardValue2

    If(DC2, Parent.BorderColor, Color.Red)

    and so on.

     

    Best regards,

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard