diff --git a/assets/js/src/form/fields/checkbox.jsx b/assets/js/src/form/fields/checkbox.jsx index c833d52b3a..3bc2c68134 100644 --- a/assets/js/src/form/fields/checkbox.jsx +++ b/assets/js/src/form/fields/checkbox.jsx @@ -1,48 +1,43 @@ -define([ - 'react', -], -( - React -) => { - const FormFieldCheckbox = React.createClass({ - onValueChange: function onValueChange(e) { - e.target.value = this.checkbox.checked ? '1' : '0'; - return this.props.onValueChange(e); - }, - render: function render() { - if (this.props.field.values === undefined) { - return false; - } +import React from 'react'; - // isChecked will be true only if the value is "1" - // it will be false in case value is "0" or empty - const isChecked = !!(Number(this.props.item[this.props.field.name])); - const options = Object.keys(this.props.field.values).map( - (value, index) => ( -
- -
- ) - ); +const FormFieldCheckbox = React.createClass({ + onValueChange: function onValueChange(e) { + e.target.value = this.checkbox.checked ? '1' : '0'; + return this.props.onValueChange(e); + }, + render: function render() { + if (this.props.field.values === undefined) { + return false; + } - return ( -+ +
+ ) + ); - return FormFieldCheckbox; + return ( +