Le second clic sur un choix de question à choix multiples le valide

pull/151/head
mama 2018-01-24 10:35:07 +01:00
parent 64fd6b84bf
commit 2e0ee3fddf
1 changed files with 10 additions and 2 deletions

View File

@ -133,8 +133,16 @@ let RadioLabel = props => (
@HoverDecorator
class RadioLabelContent extends Component {
state = {
active: null
}
click = value => () => {
this.props.setFormValue(value)
if (this.state.active !== value) this.setState({ active: value })
else this.props.submit()
}
render() {
let { value, label, input, hover, themeColours, setFormValue } = this.props,
let { value, label, input, hover, themeColours } = this.props,
// value = when(is(Object), prop('value'))(choice),
labelStyle = Object.assign(
value === input.value || hover
@ -149,7 +157,7 @@ class RadioLabelContent extends Component {
<input
type="radio"
{...input}
onClick={() => setFormValue(value)}
onClick={this.click(value)}
value={value}
checked={value === input.value ? 'checked' : ''}
/>