diff --git a/frontend/src/component/feature/form/index.jsx b/frontend/src/component/feature/form/index.jsx index 98050c541f..c6de46468b 100644 --- a/frontend/src/component/feature/form/index.jsx +++ b/frontend/src/component/feature/form/index.jsx @@ -4,6 +4,14 @@ import Button from 'react-toolbox/lib/button'; import Switch from 'react-toolbox/lib/switch'; import StrategiesSection from './strategies-section-container'; +const trim = (value) => { + if (value && value.trim) { + return value.trim(); + } else { + return value; + } +}; + class AddFeatureToggleComponent extends Component { componentWillMount () { @@ -46,7 +54,7 @@ class AddFeatureToggleComponent extends Component { value={name} error={nameError} onBlur={(v) => validateName(v)} - onChange={(v) => setValue('name', v)} /> + onChange={(v) => setValue('name', trim(v))} /> { + if (value && value.trim) { + return value.trim(); + } else { + return value; + } +}; + function gerArrayWithEntries (num) { return Array.from(Array(num)); } @@ -33,7 +41,7 @@ const AddStrategy = ({ setValue('name', value)} + onChange={(value) => setValue('name', trim(value))} value={input.name} />