     value[ref] = el.getValue() for ref, el of @refs when el.getValue?
     value
 
-  setValue: (data) ->
-    @setState attributes: data
+  setValue: (data = {}) ->
+    @refs[field.ref].setValue? field.value for field in data

    <form data-component-form className={@props.className}
          onSubmit={@onSubmit} onChange={@onChange}>
      {
        for attribute, index in @props.attributes
          if attribute.type is "submit"
            <Button {...attribute} type="square" ref="submit" onClick={@onSubmit}/>
          else if attribute.type is "autocomplete"

  onChange: (event) ->
    is_valid = true
    value = @getValue()
    for attr in @state.attributes when attr.required and value[attr.ref]?.trim() is ""
      is_valid = false
      @refs[attr.ref].setError? "Required field"
      break
