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 / How do I apply validat...
Power Apps
Unanswered

How do I apply validation on checkboxes for a single entry?

(0) ShareShare
ReportReport
Posted on by

Hello,

 

I have 3 checkboxes to specify value for a one single column in excel file on PowerApps form.

 

Field1 : [] Checkbox 1 [] Checkbox 2 [] Checkbox 3

 

If user does not select any of the checkbox, then I need to show validation message, How can I achieve it?

 

Thanks,

Categories:
I have the same question (0)
  • Verified answer
    mdevaney Profile Picture
    29,989 Moderator on at

    @dave8 

    There are several ways to do this can be done based on your preferences.  I will suggest one!

     

    Put this code in the OnSelect property of your submit button.  It will submit the form if at least 1 checkbox is checked otherwise it will display an error message in a banner. 

     

    If(
     Checkbox1.Value Or Checkbox2.Value Or Checkbox3.Value,
     SubmitForm(Form1),
     Notify("You must select an option before submitting the form", Notification.Warning),
    )

     

    ---
    Please click "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 Profile Picture
    on at

    Hi @dave8 ,

    You could achieve your validation logic within the OnSelect property of the "Submit" button:

    If(
     Checkbox1.Value = false && Checkbox2.Value = false && Checkbox3.Value = false,
     Notify("Please check one Checkbox at least for submitting your form data", NotificationType.Error),
     SubmitForm(EditForm1)
    )

    When you press "Submit" button, above validation logic would be executed.

     

    In addition, you should also need to bind the Field1 to any combination of these three Checkboxes. Please set the Update property of the Field1 data card in your Edit form to following:

    If(
     Checkbox1.Value,
     Checkbox1.Text & ";",
     Blank()
    ) &
    If(
     Checkbox2.Value,
     Checkbox2.Text & ";",
     Blank()
    ) &
    If(
     Checkbox3.Value,
     Checkbox3.Text & ";",
     Blank()
    )

    Note: If you use Patch function to submit your data back to Excel table, you could also use above formula to assign value to the Field1.

     

    Best regards,

  • mdevaney Profile Picture
    29,989 Moderator on at
    @v-xida-msft
    It looks like you copied my code from above and restated what I already said. I’m not sure why you felt the need to change the 1st argument of the IF condition though. It does exactly the same thing... so basically so you are just agreeing with me...

    My code:
    Checkbox1.Value Or Checkbox2.Value Or Checkbox3.Value

    Your code (does the same thing)
    Checkbox1.Value = false && Checkbox2.Value = false && Checkbox3.Value = false
  • v-xida-msft Profile Picture
    on at

    Hi @mdevaney ,

    Yeah, for the validation logic, I agree with your almost.  For how to bind the Checkbox value to the Field1 in Excel table within Data Table, I think formula I provided above is proper for this scenario.

     

    Best regards,

  • mdevaney Profile Picture
    29,989 Moderator on at
    @v-xida-msft
    Ok cool it seems like we are on the same page then.

    Yes, agreed on the binding logic. That was a good addition.

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 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard