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

how to Disable other checkbox and select single

Hi 

 

I have gallery and i want to select single checkbox and make all other checkbox disable and similar if i uncheck the box enable,

so user can select only one checkbox .

 

i have workaround where user can select single checkbox but then it does not allow me to deselect the one, i have to create separate button to reset ,

 

Tried below article but it does not work

 

https://powerusers.microsoft.com/t5/Building-Power-Apps/Select-single-checkbox-within-a-Gallery/td-p...

1 ACCEPTED SOLUTION

Accepted Solutions

OK @Ashok2 ,

As mentioned free=typed without testing. It seems you cannot refer to a Gallery from inside it, so put this on a Label (I will call it CheckLabel here) and hide it

CountRows(
   Filter(
      Gallery4.AllItems,
      Checkbox4.Value
   )
) > 0

 Now on the DisplayMode of the CheckBox

If(
   CheckLabel.Text = "true" && !ThisItem.IsSelected,
   DisplayMode.Disabled,
   DisplayMode.Edit
)

 I have tested it and it works - you might also consider hiding the boxes (Visible true/false)

DisableCheckbox.gif

 

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
WarrenBelz
Super User
Super User

Hi @Ashok2 ,

You have several checkboxes in the gallery - as an example with three, on the DisplayMode of CheckBox1

If(
  CheckBox2.Value || CheckBox3.Value,
  DisplayMode.Disabled,
  DisplayMode.Edit
)

Do the same with the others referring to all other checkboxes (other than itself).

 

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 

i have only one checkbox in my gallery which come with each item so behavior of each checkbox is same

@Ashok2 ,

On the DisplayMode of the checkbox

If(
   CountRows(
      Filter(
         YourGalleryName.AllItemns,
         CheckBoxName.Value
      )
   ) > 0
   &&
   !ThisItem.IsSelected,
   DisplayMode.Disabled,
   DisplayMode.Edit
)

 

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 

 

Tryin  but getting below error

 

Ashok2_0-1617698219913.png

 

@Ashok2 ,

See corrected post (dangers of free-typing) - needs to be Gallery4.AllItems

 

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 

 

Trying writing Gallery4.Allitems but unable to get all items getting same error 

Ashok2_0-1617699178566.png

 

OK @Ashok2 ,

As mentioned free=typed without testing. It seems you cannot refer to a Gallery from inside it, so put this on a Label (I will call it CheckLabel here) and hide it

CountRows(
   Filter(
      Gallery4.AllItems,
      Checkbox4.Value
   )
) > 0

 Now on the DisplayMode of the CheckBox

If(
   CheckLabel.Text = "true" && !ThisItem.IsSelected,
   DisplayMode.Disabled,
   DisplayMode.Edit
)

 I have tested it and it works - you might also consider hiding the boxes (Visible true/false)

DisableCheckbox.gif

 

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.

Why are the disabled options still checkable?

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.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

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 (5,260)