cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ashok2
Post Patron
Post Patron

checkbox mandatory field in powerapps

Hi i am working on the form where if i make checkbox  requried field it does not throw submission error while submitting data in powerapps , even the field is mandatory it work for text box and drodown but not for checkbox

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @Ashok2 ,
The easiest way is to do a check on your Save button and give a message. I will call the CheckBox Check1 and your form MyForm

If(
   Check1.Value = true,
   SubmitForm(MyForm),
   Notify("you must check the box", NotificationType.Error)
)
   

This will put a red message across the top of the screen instead of saving the form. 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

8 REPLIES 8
PowerAddict
Super User
Super User

The thing is how do you define a checkbox being mandatory? If it is unchecked, it could be by choice. There are only two possible outcomes with a checkbox (checked or unchecked) and we cannot say unchecked equates to user not providing a value, as not checking it is a perfectly viable option. If for you, required equates to the user checking the checkbox, you can add some logic to it. Let me know if that is your use case and I can provide more details. 

 

Does that help? 

 

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

 

Thanks!
Hardit Bhatia
https://thepoweraddict.com

WarrenBelz
Super User
Super User

Hi @Ashok2 ,
The easiest way is to do a check on your Save button and give a message. I will call the CheckBox Check1 and your form MyForm

If(
   Check1.Value = true,
   SubmitForm(MyForm),
   Notify("you must check the box", NotificationType.Error)
)
   

This will put a red message across the top of the screen instead of saving the form. 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

@WarrenBelz

Just want to add that the above logic assumes making the checkbox mandatory = checking the checkbox which, in most case, will not be true or desired.

Which is why, there is no "out of the box" validation for a checkbox even though you can mark it as required.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
https://thepoweraddict.com

Hi @PowerAddict ,

That is why I made my logic as having to be true to proceed. I assumed that @Ashok2 wanted the user to check a box acknowledging something before saving.

Sure thing. I just wanted to make it clear to @Ashok2 that implementing this will force the user to check the checkbox, if that's the desired outcome, then this will be perfect. But if not, there is no way to know that a user has responded to checkbox.

Yes its correct if checkbox is not checked it passing the value no which will lead to incorrect information so i changed the behaviour to dropdown which reslove my issue thanks all for your responses

Hi @Ashok2 ,

If you are wanting an error with no value or false, then the test I did (unless it is true, do not save it but give a message will work.

I am trying to diable a button if a checkbox is unchecked. But for some reason Checkox.value=true, .value is being underlined in red. I tried to reproduce, it works the first time and if I edit the formula it starts undying .value. 

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 (2,808)