Add readonly attribute to checkbox list items

Support General Add readonly attribute to checkbox list itemsResolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #30881
    ben06ben06
    Participant

    Hi,

    How could I add a readonly attribute to checkbox list items if one them is checked.

    Ex:

    
    [
     'name'    => __( 'Choices' ),
     'id'      => 'choices',
     'type'    => 'checkbox_list',
     'options' => [
                   'none'    => __( 'None', 'your-text-domain' ),
                   '1'       => __( '1', 'your-text-domain' ),
                   '2'       => __( '2', 'your-text-domain' ),
                   '3'       => __( '3', 'your-text-domain' ),
                  ],
    ],
    

    If 'None' is checked, '1', '2', '3' have to be readonly.

    I know it's weird, i can split this field with 2 radio button fields but I have to use 1 checkbox list.

    Any thoughts?

    Thank you 🙂

    #30891
    Long NguyenLong Nguyen
    Moderator

    Hi,

    This field does not support a feature like that. But I think you can use the setting select_all_none to toggle all/none checkboxes. Please read more on the documentation https://docs.metabox.io/fields/checkbox-list/#settings

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.