10 examples of 'multiple checkbox validation in javascript' in JavaScript

Every line of 'multiple checkbox validation in javascript' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
128_setChecked (values, el) {
129 for (let i = 0, l = values.length; i < l; i++) {
130 let value = values[i]
131 if (!el.disabled && el.value === value && !el.checked) {
132 el.checked = true
133 }
134 }
135}
104_setChecked (value, el, item) {
105 if (el.value === value) {
106 el.checked = true
107 this._init = el.checked
108 item.init = el.checked
109 item.value = value
110 }
111}
3function check_checkbox (checkbox) {
4 if (checkbox.prop('checked')) {
5 checkbox.parents('label.checkbox').addClass('checkbox_state_cheked');
6 } else {
7 checkbox.parents('label.checkbox').removeClass('checkbox_state_cheked');
8 }
9}
78function set_checkbox_value(id, value) {
79 $('#' + id).prop('checked', value);
80}
92validateChecked(item: any): boolean {
93 return this.lookupValue(item) === this.lookupValue(this.value);
94}
5function checkboxChanged(checkboxInput) {
6 var $rgbaInput = $(checkboxInput).siblings('input.cascade-rgba');
7 var $colorInput = $(checkboxInput).siblings('input[type="color"]');
8 if (checkboxInput.checked || checkboxInput.disabled) {
9 $rgbaInput.addClass('disabled');
10 $colorInput.addClass('disabled');
11 } else {
12 $rgbaInput.removeClass('disabled');
13 $colorInput.removeClass('disabled');
14 }
15}
21function validate(container) {
22 return required.complexValidationHelper({container: container,
23 widget: radioButtonSelect.getWidget(),
24 constraint: required.CONSTRAINTS.CLASSNAME,
25 position: "beforeEnd"
26 });
27}
69function checkRadioButton( name, value ){
70 var radiobuttons = document.querySelectorAll('input[name="'+name+'"]')
71 for( let i = 0, lg = radiobuttons.length; i
26updateCheckbox() {
27 const { props, refElements } = this;
28 Object.keys(refElements).forEach(function(refName) {
29 const checkbox = ReactDOM.findDOMNode(refElements[refName]);
30 let indeterminate;
31 // Single checkbox
32 if (props.name === refName) {
33 indeterminate = props.indeterminate;
34 }
35
36 // Multiple checkboxes
37 if (Util.isArray(props.startValue)) {
38 indeterminate = Util.find(props.startValue, function(item) {
39 return item.name === refName;
40 }).indeterminate;
41 }
42
43 if (indeterminate != null) {
44 checkbox.indeterminate = indeterminate;
45 }
46 });
47}
47getChecked(value) {
48 const {type} = this.props;
49 const {$viewValue} = this.props.easyfield;
50 if(type == 'radio') {
51 return {
52 checked: $viewValue == value
53 }
54 }
55
56 if(type == 'checkbox') {
57 return {
58 checked: Array.isArray($viewValue) ? !!$viewValue.find(item => value == item ) : false
59 }
60 }
61
62 return {};
63}

Related snippets