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 / Check if Check Boxes (...
Power Apps
Unanswered

Check if Check Boxes (in gallery) are Empty

(0) ShareShare
ReportReport
Posted on by 658

Hi,

 

I have some check boxes in a gallery within a new form, I would like to check if these checkboxes have been selected when a 'cover' option has been selected, this is to prevent any blank data being passed through when the form is submitted. Please see my code below, I am currently just getting a Blank or false return for the checkbox2.value check? I have tried Gallery1.Selected.Checkbox2.Value but this returns false too when the check boxes are selected!

 

togCoverRequired.Value = true && Checkbox2.Value = false,
    Notify(
        "You have selected for cover but not ticked any time slots",
        NotificationType.Error,
        8000
    ),

 

Thanks in advance.

Categories:
I have the same question (0)
  • mmbr1606 Profile Picture
    14,605 Super User 2025 Season 2 on at

    hey @BS10 

     

    you can try this:

    If(
     togCoverRequired.Value = true && CountRows(Filter(Gallery1.AllItems, Checkbox2.Value = true)) = 0,
     Notify(
     "You have selected for cover but not ticked any time slots",
     NotificationType.Error,
     8000
     )
    )
    

     

    Let me know if my answer helped solving your issue.

    If it did please accept as solution and give it a thumbs up so we can help others in the community.



    Greetings

  • BS10 Profile Picture
    658 on at

    Hi @mmbr1606,

     

    Thank you for the fast response. I have tried this below and also added a text label with the code 

    CountRows(Filter(Gallery1.AllItems,Checkbox2.Value = true)) =
    but this is always returning as true so it's accepting the form even if the checkboxes are not checked?
     
    Thank you
       
  • BS10 Profile Picture
    658 on at

    @mmbr1606 - Apologies I should have mentioned, I have multiple other if statements so I just added this before the SubmitForm property, does this make a difference?

  • mmbr1606 Profile Picture
    14,605 Super User 2025 Season 2 on at

    Can u Share your whole code please

  • BS10 Profile Picture
    658 on at

    Please see below.

     

    If(
     DataCardValue12.SelectedDate = Blank(),
     Notify(
     "Please select a date for absence",
     NotificationType.Error,
     6000
     ),
     DataCardValue10.Selected.Value = Blank(),
     Notify(
     "Please select a reason for absence",
     NotificationType.Error,
     6000
     ),
     DataCardValue19.Text = Blank(),
     Notify(
     "The special requirments field cannot be blank, please type N/A if this field is not required",
     NotificationType.Error,
     8000
     ),
     togCoverRequired.Value = true && CountRows(
     Filter(
     Gallery1.AllItems,
     Checkbox2.Value = true
     )
     ) = 0,
     Notify(
     "You have selected for cover but not ticked any time slots",
     NotificationType.Error,
     8000
     ),
     Checkbox1.Value = false,
     Notify(
     "Please tick the agree box at the end of the form",
     NotificationType.Error,
     6000
     ),
     SubmitForm(CoverSpecialLeaveForm)
    )
  • mmbr1606 Profile Picture
    14,605 Super User 2025 Season 2 on at

    can you try this:

     

    If(
     DataCardValue12.SelectedDate = Blank(),
     Notify(
     "Please select a date for absence",
     NotificationType.Error,
     6000
     ),
     If(
     DataCardValue10.Selected.Value = Blank(),
     Notify(
     "Please select a reason for absence",
     NotificationType.Error,
     6000
     ),
     If(
     DataCardValue19.Text = Blank(),
     Notify(
     "The special requirements field cannot be blank, please type N/A if this field is not required",
     NotificationType.Error,
     8000
     ),
     If(
     togCoverRequired.Value = true && CountRows(Filter(Gallery1.AllItems, Checkbox2.Value = true)) = 0,
     Notify(
     "You have selected for cover but not ticked any time slots",
     NotificationType.Error,
     8000
     ),
     If(
     Checkbox1.Value = false,
     Notify(
     "Please tick the agree box at the end of the form",
     NotificationType.Error,
     6000
     ),
     SubmitForm(CoverSpecialLeaveForm) // This is the final action if all checks pass
     )
     )
     )
     )
    )
    

     

    Let me know if my answer helped solving your issue.

    If it did please accept as solution and give it a thumbs up so we can help others in the community.



    Greetings

  • BS10 Profile Picture
    658 on at

    Hi @mmbr1606,

     

    Thank you, I have just tried this but unfortunately the notification error "you have selected for cover but not ticked any time slots" appears even if checkboxes are ticked. Just thought I would mention that this does go through successfully if the togCoverRequired is set to no (false) but then the if statement isn't being ran.

  • BS10 Profile Picture
    658 on at

    Hi @mmbr1606,

     

    I've just done a bit more testing, I added a text label and added the code below but the number just stays at 0. When I go into the text property on the text label, it says the actual amount of checkboxes that have been ticked?

     

    Thanks

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard