set checked on required checkboxes
547548
function(value) {
            this.$input.prop('checked', false);
            if($.isArray(value) && value.length) {
               this.$input.each(function(i, el) {
                   var $el = $(el);
                   // cannot use $.inArray as it performs strict comparison
                   $.each(value, function(j, val){
                       /*jslint eqeq: true*/
                       if($el.val() == val) {
                       /*jslint eqeq: false*/                           
                           $el.prop('checked', true);
                       }
                   });
               }); 
            }  
        }
159562
public function setRequired($required) {
		if(!empty($required))
			$this->validation[] = new Validation\Required;
		$this->_attributes["required"] = "";	
	}
1080629
public function checked($value = true, $check_value = true)
    {
        if ($value === $check_value) {
            return parent::attr('checked', 'checked');
        }

        return $this;
    }
279428
private void setupCheckBoxes() {

        m_includeResource.setValue(new Boolean(true));
        m_includeUnchanged.setValue(new Boolean(true));
        m_includeSystem.setValue(new Boolean(true));
        m_recursive.setValue(new Boolean(true));
    }
582981
public function setChecked(array $checked)
    {
        foreach ($this->checkboxes as $checkbox) {
            /* @var $checkbox Checkbox */
            $checkbox->setChecked(in_array($checkbox->getName(), $checked));
        }

        return $this;
    }
43427
def collection_check_boxes(method, collection, value_method, text_method, options = {}, html_options = {})
      bootstrap = form_bootstrap.scoped(options.delete(:bootstrap))
      return super if bootstrap.disabled

      content = "".html_safe
      unless options[:include_hidden] == false
        content << hidden_field(method, multiple: true, value: "")
      end

      args = [bootstrap, :check_box, method, collection, value_method, text_method, options, html_options]
      content << draw_choices(*args) do |m, v, opts|
        opts[:multiple]       = true
        opts[:include_hidden] = false
        ActionView::Helpers::FormBuilder.instance_method(:check_box).bind(self).call(m, opts, v)
      end
    end
286880
function() {
				var children = this._.children,
					i;
				for ( i = 0; i < children.length; i++ ) {
					if ( children[ i ].getElement().$.checked ) {
						children[ i ].getElement().focus();
						return;
					}
				}
				children[ 0 ].getElement().focus();
			}
804099
function() {
            if (this.hasSelectAll()) {
                var allBoxes = $("li:not(.multiselect-item):not(.filter-hidden) input:enabled", this.$ul);
                var allBoxesLength = allBoxes.length;
                var checkedBoxesLength = allBoxes.filter(":checked").length;
                var selectAllLi  = $("li.multiselect-all", this.$ul);
                var selectAllInput = selectAllLi.find("input");

                if (checkedBoxesLength > 0 && checkedBoxesLength === allBoxesLength) {
                    selectAllInput.prop("checked", true);
                    selectAllLi.addClass(this.options.selectedClass);
                    this.options.onSelectAll();
                }
                else {
                    selectAllInput.prop("checked", false);
                    selectAllLi.removeClass(this.options.selectedClass);
                }
            }
        }
116650
def check_box(method, options = {}, checked_value = "1", unchecked_value = "0")
      bootstrap = form_bootstrap.scoped(options.delete(:bootstrap))
      return super if bootstrap.disabled

      help_text = draw_help(bootstrap.help)
      errors    = draw_errors(method)

      add_css_class!(options, "form-check-input")
      add_css_class!(options, "is-invalid") if errors.present?

      label_text = nil
      if (custom_text = bootstrap.label[:text]).present?
        label_text = custom_text
      end

      fieldset_css_class = "form-group"
      fieldset_css_class += " row" if bootstrap.horizontal?
      fieldset_css_class += " #{bootstrap.inline_margin_class}" if bootstrap.inline?

      content_tag(:fieldset, class: fieldset_css_class) do
        draw_control_column(bootstrap, offset: true) do
          if bootstrap.custom_control
            content_tag(:div, class: "custom-control custom-checkbox") do
              add_css_class!(options, "custom-control-input")
              remove_css_class!(options, "form-check-input")
              concat super(method, options, checked_value, unchecked_value)
              concat label(method, label_text, class: "custom-control-label")
              concat errors     if errors.present?
              concat help_text  if help_text.present?
            end
          else
            content_tag(:div, class: "form-check") do
              concat super(method, options, checked_value, unchecked_value)
              concat label(method, label_text, class: "form-check-label")
              concat errors     if errors.present?
              concat help_text  if help_text.present?
            end
          end
        end
      end
    end
129021
public function elementValidateRequired(array $element, FormStateInterface $form_state) {
    if (!empty($element['#required_but_empty']) && isset($element['#element_required_error'])) {
      $form_state->setError($element, $element['#element_required_error']);
    }
  }
630492
public function addCheckbox($name , $title ='' ,$value = '' , $extra = [] , $required = false , $msg = '' ,$group = '' , $readonly = false){
        $this->addChoose('checkbox' , $name , $title ,$value , $extra , $required , $msg , $group , $readonly );
        return $this;
    }
403068
def set_checked(self, checked):
        
        if not checked:
            self.widget.clearCheck()
        else:
            #: Checked is a reference to the radio declaration
            #: so we need to get the ID of it
            rb = checked.proxy.widget
            if not rb:
                return
            self.widget.check(rb.getId())
12942
protected function checkBox()
	{
		$attribute = $this->attribute;
		list($hidden, $checkbox) = $this->getSeparatedSelectableInput();

		echo '<div class="controls">';
		echo ($hidden) ? $hidden . PHP_EOL : '';
		echo '<label class="checkbox" for="' . $this->getAttributeId($attribute) . '">';
		echo $checkbox . PHP_EOL;
		echo $this->model->getAttributeLabel($attribute);
		echo $this->getError() . $this->getHint();
		echo '</label></div>';
	}
1224297
protected function checkBox()
    {
        if (is_array($this->box) && count($this->box)) {
            foreach ($this->box as $name => $value) {
                switch ($name) {
                    case 'classOuter':
                        $this->addClassOption('classOuter', $value);
                        break;
                    case 'classButton':
                        $this->addClassOption('classButton', $value);
                        break;
                    case 'classInner':
                        $this->addClassOption('classInner', $value);
                        break;
                    case 'replaceOuterStyle':
                        $this->replaceStyle(0, $value);
                        break;
                    case 'replaceInnerStyle':
                        $this->replaceStyle(1, $value);
                        break;
                    case 'replaceButtonStyle':
                        $this->replaceStyle(2, $value);
                        break;
                    case 'addOuterStyle':
                        $this->addStyle(0, $value);
                        break;
                    case 'addInnerStyle':
                        $this->addStyle(1, $value);
                        break;
                    case 'addButtonStyle':
                        $this->addStyle(2, $value);
                        break;
                    case 'setOuterStyle':
                        $this->setStyle(0, $value);
                        break;
                    case 'setInnerStyle':
                        $this->setStyle(1, $value);
                        break;
                    case 'setButtonStyle':
                        $this->setStyle(2, $value);
                        break;
                    case 'view':
                        $this->setCookieView($value);
                        break;
                    case 'outerHtmlOptions':
                        $this->setHtmlOptions(0, $value);
                        break;
                    case 'innerHtmlOptions':
                        $this->setHtmlOptions(1, $value);
                        break;
                    case 'buttonHtmlOptions':
                        $this->setHtmlOptions(2, $value);
                        break;
                }
            }
        }
    }
1075039
public function setCheckboxes(array $checkboxes)
    {
        foreach ($checkboxes as $name => $label) {
            $this->checkboxes[$label] = new Checkbox($name);
        }

        return $this;
    }
940746
def setChecked(src, ids=[], dpth = 0, key = ''):
    
    #tabs = lambda n: ' ' * n * 4 # or 2 or 8 or...
    #brace = lambda s, n: '%s%s%s' % ('['*n, s, ']'*n)

    if isinstance(src, dict):
        for key, value in src.iteritems():
            setChecked(value, ids, dpth + 1, key)
    elif isinstance(src, list):
        for litem in src:
            if isinstance(litem, types.DictType):
	            if "id" in litem and litem["id"] in ids:
	            	litem["checked"] = True
	            	litem["select"] = True
            setChecked(litem, ids, dpth + 2)
975153
private void checkExactlyTheWeeksCheckBoxes(Collection<WeekOfMonth> weeksToCheck) {

        for (CmsCheckBox cb : m_checkboxes) {
            cb.setChecked(weeksToCheck.contains(WeekOfMonth.valueOf(cb.getInternalValue())));
        }
    }