Wrapper for collections of radio buttons and checkboxes
961160
def draw_form_group_fieldset(bootstrap, method)
      options = {}

      unless bootstrap.label[:hide]
        label_text = bootstrap.label[:text]
        label_text ||= ActionView::Helpers::Tags::Label::LabelBuilder
          .new(@template, @object_name.to_s, method, @object, nil).translation

        add_css_class!(options, "col-form-label pt-0")
        add_css_class!(options, bootstrap.label[:class])

        if bootstrap.horizontal?
          add_css_class!(options, bootstrap.label_col_class)
          add_css_class!(options, bootstrap.label_align_class)
        end

        label = content_tag(:legend, options) do
          label_text
        end
      end

      content_tag(:fieldset, class: "form-group") do
        content = "".html_safe
        content << label if label.present?
        content << draw_control_column(bootstrap, offset: bootstrap.label[:hide]) do
          yield
        end

        if bootstrap.horizontal?
          content_tag(:div, content, class: "row")
        else
          content
        end
      end
    end
679815
private void setupRadioButtonEventHandlers() {
    for (int i = 0; i < radioButtons.size(); i++) {
      final int j = i;
      radioButtons.get(j).setOnAction(event -> field.select(j));
    }
  }
720418
function(ev, items, index) {
                        // Collect new html and mappings
                        var frag = document.createDocumentFragment(),
                            newNodeLists = [],
                            newIndicies = [];
                        // For each new item,
                        can.each(items, function(item, key) {
                            var itemIndex = can.compute(key + index),
                                // get its string content
                                itemHTML = render.call(context, item, itemIndex),
                                gotText = typeof itemHTML === "string",
                                // and convert it into elements.
                                itemFrag = can.frag(itemHTML);
                            // Add those elements to the mappings.

                            itemFrag = gotText ? can.view.hookup(itemFrag) : itemFrag;

                            var childNodes = can.makeArray(itemFrag.childNodes);



                            newNodeLists.push(nodeLists.register(childNodes));
                            // Hookup the fragment (which sets up child live-bindings) and
                            // add it to the collection of all added elements.
                            frag.appendChild(itemFrag);
                            // track indicies;
                            newIndicies.push(itemIndex);
                        });
                        // The position of elements is always after the initial text placeholder node
                        var masterListIndex = index + 1;


                        // Check if we are adding items at the end
                        if (!masterNodeList[masterListIndex]) {
                            elements.after(masterListIndex === 1 ? [text] : [nodeLists.last(masterNodeList[masterListIndex - 1])], frag);
                        } else {
                            // Add elements before the next index's first element.
                            var el = nodeLists.first(masterNodeList[masterListIndex]);
                            can.insertBefore(el.parentNode, frag, el);
                        }
                        splice.apply(masterNodeList, [
                                masterListIndex,
                                0
                            ].concat(newNodeLists));

                        // update indices after insert point
                        splice.apply(indexMap, [
                                index,
                                0
                            ].concat(newIndicies));

                        for (var i = index + newIndicies.length, len = indexMap.length; i < len; i++) {
                            indexMap[i](i);
                        }
                    }
158687
function checkboxHandler (event) {
    const target = event.target;

    if (target.checked) {
      link.style.display = 'none';
      if (upload.value) {
        upload.value = '';
        link = clear(link);
      }
    }
    else {
      link.style.display = '';
    }
  }
308165
private void createRadioButtons() {
    node.getChildren().clear();
    radioButtons.clear();

    for (int i = 0; i < field.getItems().size(); i++) {
      RadioButton rb = new RadioButton();

      rb.setText(field.getItems().get(i).toString());
      rb.setToggleGroup(toggleGroup);

      radioButtons.add(rb);
    }

    if (field.getSelection() != null) {
      radioButtons.get(field.getItems().indexOf(field.getSelection())).setSelected(true);
    }

    node.getChildren().addAll(radioButtons);
  }
882936
function( field, resque ) {
					if ( field.attr( "name" ) === undefined && field.attr( "id" ) === undefined ) {
						return false;
					}
					var name = field.attr( "name" );
					if ( field.is( ":checkbox" ) && resque !== "false" && ( name === undefined || name.indexOf( "[" ) === -1 ) ) {
						// If we aren't named by name (e.g. id) or we aren't in a multiple element field
						field.prop( "checked", true );
					} else if( field.is( ":checkbox" ) && resque === "false" && ( name === undefined || name.indexOf( "[" ) === -1 ) ) {
						// If we aren't named by name (e.g. id) or we aren't in a multiple element field
						field.prop( "checked", false );
					} else if ( field.is( ":radio" ) ) {
						if ( field.val() === resque ) {
							field.prop( "checked", true );
						}
					} else if ( name === undefined || name.indexOf( "[" ) === -1 ) {
						// If we aren't named by name (e.g. id) or we aren't in a multiple element field
						field.val( resque );
					} else {
						resque = resque.split( "," );
						field.val( resque );
					}
				}
905831
function (title, fields, cmd) {
            var t = this,
                prefix = t.o.prefix,
                lg = t.lang,
                html = '';

            $.each(fields, function (fieldName, field) {
                var l = field.label || fieldName,
                    n = field.name || fieldName,
                    a = field.attributes || {};

                var attr = Object.keys(a).map(function (prop) {
                    return prop + '="' + a[prop] + '"';
                }).join(' ');

                html += '<label><input type="' + (field.type || 'text') + '" name="' + n + '"' +
                    (field.type === 'checkbox' && field.value ? ' checked="checked"' : ' value="' + (field.value || '').replace(/"/g, '&quot;')) +
                    '"' + attr + '><span class="' + prefix + 'input-infos"><span>' +
                    (lg[l] ? lg[l] : l) +
                    '</span></span></label>';
            });

            return t.openModal(title, html)
                .on(CONFIRM_EVENT, function () {
                    var $form = $('form', $(this)),
                        valid = true,
                        values = {};

                    $.each(fields, function (fieldName, field) {
                        var n = field.name || fieldName;

                        var $field = $('input[name="' + n + '"]', $form),
                            inputType = $field.attr('type');

                        switch (inputType.toLowerCase()) {
                            case 'checkbox':
                                values[n] = $field.is(':checked');
                                break;
                            case 'radio':
                                values[n] = $field.filter(':checked').val();
                                break;
                            default:
                                values[n] = $.trim($field.val());
                                break;
                        }
                        // Validate value
                        if (field.required && values[n] === '') {
                            valid = false;
                            t.addErrorOnModalField($field, t.lang.required);
                        } else if (field.pattern && !field.pattern.test(values[n])) {
                            valid = false;
                            t.addErrorOnModalField($field, field.patternError);
                        }
                    });

                    if (valid) {
                        t.restoreRange();

                        if (cmd(values, fields)) {
                            t.syncCode();
                            t.$c.trigger('tbwchange');
                            t.closeModal();
                            $(this).off(CONFIRM_EVENT);
                        }
                    }
                })
                .one(CANCEL_EVENT, function () {
                    $(this).off(CONFIRM_EVENT);
                    t.closeModal();
                });
        }
966166
function checkboxNode(selection) {
  selection.append('span').classed('arrow', true);
  selection.append('input')
      .attr('type', 'checkbox');
  selection.append('span')
      .classed('label', true);
}
1247299
def check_checkbox(checkBoxName, values=nil)
        elements = find_checkboxes_by_name(checkBoxName)
        if values
          values.class == Array ? arys = values : arys = [values]          
          arys.each { |cbx_value|
            elements.each do |elem|
              elem.click if elem.attribute('value') == cbx_value && !elem.selected?
            end
          }
        else
          the_checkbox = elements[0] 
          the_checkbox.click unless the_checkbox.selected?
        end
      end
795917
def collection_check_boxes2(method, collection, value_method, text_method, options = {}, html_options = {})
      html_options ||= {}
      html_options[:multiple] = 'multiple'
      collection_select2 method, collection, value_method, text_method, options, html_options
    end
720448
static function radio($name, $option, $default = null, $self = false, $attrArray = null, $label_class = '')
	{
		$htmlStr = "";
	    $attrStr = self::input_attr($attrArray);

		foreach($option as $key => $value)
		{
			if($self) $key=$value;
			if ($key == $default)
			{
				$htmlStr .= "<label class='$label_class'><input type=\"radio\" name=\"$name\" id=\"{$name}_{$key}\" value=\"$key\" checked=\"checked\" {$attrStr} />".$value."</label>";
			}
			else
			{
				$htmlStr .= "<label class='$label_class'><input type=\"radio\" name=\"$name\" id=\"{$name}_{$key}\" value=\"$key\"  {$attrStr} />&nbsp;".$value."</label>";
			}
		}
		return $htmlStr;
	}
1199600
def get_parameter(self):
        
        # Set value for each key
        for key, value in list(self._parameter.options.items()):
            if value.get('type') == STATIC:
                continue
            elif value.get('type') == SINGLE_DYNAMIC:
                new_value = self.spin_boxes.get(key).value()
                self._parameter.set_value_for_key(key, new_value)
            elif value.get('type') == MULTIPLE_DYNAMIC:
                # Need to iterate through all items
                items = []
                for index in range(self.list_widget.count()):
                    items.append(self.list_widget.item(index))
                new_value = [i.text() for i in items]
                self._parameter.set_value_for_key(key, new_value)

        # Get selected radio button
        radio_button_checked_id = self.input_button_group.checkedId()
        # No radio button checked, then default value = None
        if radio_button_checked_id == -1:
            self._parameter.selected = None
        else:
            self._parameter.selected = list(self._parameter.options.keys())[
                radio_button_checked_id]

        return self._parameter
1344504
def scopes_multi_checkbox(field, **kwargs):
    """"""
    kwargs.setdefault('type', 'checkbox')
    field_id = kwargs.pop('id', field.id)

    html = [u'<div class="row">']

    for value, label, checked in field.iter_choices():
        choice_id = u'%s-%s' % (field_id, value)

        options = dict(
            kwargs,
            name=field.name,
            value=value,
            id=choice_id,
            class_=' ',
        )

        if checked:
            options['checked'] = 'checked'

        html.append(u'<div class="col-md-3">')
        html.append(u'<label for="{0}" class="checkbox-inline">'.format(
            choice_id
        ))
        html.append(u'<input {0} /> '.format(widgets.html_params(**options)))
        html.append(u'{0} <br/><small class="text-muted">{1}</small>'.format(
            value, label.help_text
        ))
        html.append(u'</label></div>')
    html.append(u'</div>')

    return HTMLString(u''.join(html))
1371474
function($input) {
        var type = $input.attr('type'),
            val = $input.val();

        // Is this an unchecked checkbox or radio button?
        if ((type === 'checkbox' || type === 'radio')) {
            if ($input.prop('checked')) {
                return val;
            }
            else {
                return null;
            }
        }

        // Flatten any array values whose input name doesn't end in "[]"
        //  - e.g. a multi-select
        else if (Garnish.isArray(val) && $input.attr('name').substr(-2) !== '[]') {
            if (val.length) {
                return val[val.length - 1];
            }
            else {
                return null;
            }
        }

        // Just return the value
        else {
            return val;
        }
    }
1331797
function isCheckable(elem) {
  var type = elem.type;
  var nodeName = elem.nodeName;
  return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio');
}
543143
def gen_checkbox_list(sig_dic):
    '''
    
    '''
    view_zuoxiang = '''<span class="iga_pd_val">'''

    dic_tmp = sig_dic['dic']
    for key in dic_tmp.keys():
        tmp_str = '''{{% if "{0}" in postinfo.extinfo["{1}"] %}} {2}  {{% end %}}
        '''.format(key, sig_dic['en'], dic_tmp[key])
        view_zuoxiang += tmp_str

    view_zuoxiang += '''</span>'''
    return view_zuoxiang
330350
public function radios($name, $label = null, $choices = [], $checkedValue = null, $inline = false, array $options = [])
    {
        $elements = '';

        foreach ($choices as $value => $choiceLabel) {
            $checked = $value === $checkedValue;

            $elements .= $this->radioElement($name, $choiceLabel, $value, $checked, $inline, $options);
        }

        $wrapperOptions = $this->isHorizontal() ? ['class' => $this->getRightColumnClass()] : [];
        $wrapperElement = '<div' . $this->html->attributes($wrapperOptions) . '>' . $elements . $this->getFieldError($name) . $this->getHelpText($name, $options) . '</div>';

        return $this->getFormGroup($name, $label, $wrapperElement);
    }