diff --git a/source/components/conversation/FormDecorator.js b/source/components/conversation/FormDecorator.js index 7bcc8973b..29e00eb62 100644 --- a/source/components/conversation/FormDecorator.js +++ b/source/components/conversation/FormDecorator.js @@ -85,9 +85,11 @@ export var FormDecorator = formType => RenderField => /* There won't be any answer zone here, widen the question zone */ let wideQuestion = formType == 'rhetorical-question' && !possibleChoice + let { pre = v => v, test, error } = valueType ? valueType.validator : {}, validate = test && (v => (v && test(pre(v)) ? undefined : error)) + let question = (

@@ -43,11 +43,8 @@ export default class Input extends Component { } onKeyDown={ ({ key }) => - key == 'Enter' && - input.value && - (!error ? submit() : input.onBlur()) - - // blur will trigger the error + key == 'Enter' + && (submitDisabled ? input.onBlur() : submit()) } /> {suffixed && ( @@ -60,7 +57,7 @@ export default class Input extends Component { )} diff --git a/source/components/conversation/SendButton.js b/source/components/conversation/SendButton.js index cc12d665a..a4e15236d 100644 --- a/source/components/conversation/SendButton.js +++ b/source/components/conversation/SendButton.js @@ -4,16 +4,16 @@ import HoverDecorator from 'Components/HoverDecorator' @HoverDecorator export default class SendButton extends Component { getAction(){ - let {sendButtonDisabled, error, submit } = this.props - return () => (!sendButtonDisabled && !error ? submit() : null) + let {disabled, submit } = this.props + return () => (!disabled ? submit() : null) } render() { - let { sendButtonDisabled, themeColours, hover } = this.props + let { disabled, themeColours, hover } = this.props return (