diff --git a/js/component/form.js b/js/component/form.js index 1d2b63bf6..33e4aee66 100644 --- a/js/component/form.js +++ b/js/component/form.js @@ -22,9 +22,12 @@ var FormField = React.createClass({ } }, componentWillMount: function() { - if (['text', 'radio', 'checkbox', 'file'].indexOf(this.props.type) != -1) { + if (['text', 'radio', 'checkbox', 'file'].includes(this.props.type)) { this._element = 'input'; this._type = this.props.type; + } else if (this.props.type == 'text-number') { + this._element = 'input'; + this._type = 'text'; } else { // Non field, e.g. , this._element = this.props.type; @@ -56,8 +59,7 @@ var FormField = React.createClass({ getValue: function() { if (this.props.type == 'checkbox') { return this.refs.field.checked; - } - else if (this.props.type == 'file') { + } else if (this.props.type == 'file') { return this.refs.field.files[0].path; } else { return this.refs.field.value; @@ -68,7 +70,7 @@ var FormField = React.createClass({ }, render: function() { // Pass all unhandled props to the field element - var otherProps = Object.assign({}, this.props); + const otherProps = Object.assign({}, this.props); delete otherProps.type; delete otherProps.hidden; @@ -76,6 +78,7 @@ var FormField = React.createClass({ !this.props.hidden ? {this.props.children} diff --git a/scss/_gui.scss b/scss/_gui.scss index 965d7ce78..dd2e7149a 100644 --- a/scss/_gui.scss +++ b/scss/_gui.scss @@ -255,6 +255,14 @@ input[type="text"], input[type="search"] display: inline-block; } +.form-field--text { + width: 330px; +} + +.form-field--text-number { + width: 50px; +} + .form-field-advice-container { position: relative; }