Set default value for fieldset type option

old
Javi Jiménez 2015-08-24 23:35:38 +06:00
parent 92bd5ca242
commit d5be4f13b9
1 changed files with 6 additions and 0 deletions

View File

@ -40,6 +40,12 @@ module.exports = React.createClass
@setState attributes: attributes, type: _determineType attributes
@setValue next_props.value or @props.value
componentDidUpdate: ->
if @state.type is TYPE.RADIO
no_active = true
no_active = false for key, ref of @refs when ref.getValue?() is true
@refs[default].setValue true if no_active and default = Object.keys(@refs)?[0]
# -- Events
onChange: (event) ->
if @state.type is TYPE.RADIO