Class: Glib::JsonUi::ViewBuilder::Fields::CheckGroup

Inherits:
AbstractField show all
Defined in:
app/helpers/glib/json_ui/view_builder/fields.rb

Overview

Group of checkbox fields managed as a collection.

Manages multiple checkboxes as a single form field, useful for multi-select scenarios where values are submitted as an array.

Examples:

Basic checkbox group

form.fields_checkGroup \
  name: 'user[skills][]',
  uncheckValue: 1,
  childViews: ->(group) do
    group.fields_check checkValue: 2, label: 'Game Development (readOnly)', readOnly: true
    group.fields_check checkValue: 3, label: 'Web Development'
    group.fields_check checkValue: 4, label: 'Mobile Development'
  end

Checkbox group with “none of above” option

form.fields_checkGroup \
  valueForDisableAll: 'none_of_above',
  name: 'user[favorite_fruits][]',
  value: 'grape',
  uncheckValue: 1,
  childViews: ->(group) do
    group.fields_check label: 'Grape', checkValue: 'grape'
    group.fields_check label: 'Banana', checkValue: 'banana'
    group.fields_check label: 'Durian', checkValue: 'durian'
    group.fields_check label: 'I dont like fruits', checkValue: 'none_of_above'
  end

See Also:

  • Garage example

Instance Attribute Summary

Attributes inherited from JsonUiElement

#json, #page

Method Summary

Methods inherited from AbstractField

#autoValidate, #context, #created, #default_url_options, #determine_value, #disableDirtyCheck, #hint, #hint_args, #label, #label_args, #name, #placeholder, #placeholder_args, #prop, #validation, #value

Methods inherited from View

component_name

Methods inherited from JsonUiElement

action, any, array, badgeable, bool, color, component_name, date, date_time, enum, float, hash, icon, #initialize, int, length, menu, panels_builder, #props, required, singleton_array, string, text, url, views

Constructor Details

This class inherits a constructor from Glib::JsonUi::JsonUiElement