添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Set Value for a field via code? #369

@flyfy1

Description

I'm creating a customised component for my form.

What I want: after I click a certain location, in my onClick handler, I can set the corresponding value for the form field.

How to do that?

My current solution:

_onClick(value, evt) {
  const {field, dispatch} = this.props
  if(dispatch){
    dispatch({type: "redux-form/CHANGE", field: field.name, value: value, touch: false, form: field.form})

it doesn't work yet.. but even if it works, I feel this is kind of hack.

Any better solution?