react-select icon indicating copy to clipboard operation
react-select copied to clipboard

React-Select + redux form 6 - After clearing Select.Creatable values redux form field still shows under values.(empty though)

Open swp44744 opened this issue 9 years ago • 0 comments

Hello,

I am using react-select 1.0* - Select.Creatable+multi options feature with redux form 6. everything works as expected, redux form creates field as a form Field and values etc. only thing I observed is after clearing all the values. Redux form still shows Field under values section of the form as empty array. Problem is when I will submit the form, redux form will send an empty array field to the server. I want to keep this field non mandatory so I can not force user to select at least one value once touched.

hear is my code: in render() <Field name="field name" type="text" component={this.renderFields} sourceData={dataArray}/>

renderFields: renderFields = ({input, name, label, currentAttribute, meta: {touched, error}}) => { let currentValues = sourceData.dataValue; return ( <div> <Select.Creatable options = { currentValues.map((item, index)=>{ return{value: item['value'], label: item['value']} }) } {...input} onBlur={() => input.onBlur(input.value) } multi={true} /> </div> )}

Below is the screen shot of form fields in console.

screen shot 2016-12-20 at 9 21 56 am

swp44744 avatar Dec 20 '16 16:12 swp44744