reactjs - Redux Form - Return current input value as string onChange -


i'm trying show 'tick' next input when contains @ least 1 character show required field being valid. issue have when console.log(textentered) each time field changes receive object containing typed letters instead of complete string. if typed in 'hello' example log looks (ignore undefined):

enter image description here

here redux field component:

handleinput = (textentered) => {   console.log(textentered);   this.setstate({ textentered }, () => {     if (this.state.textentered.length) {       this.setstate({ completed: true });     } else {       this.setstate({ completed: false });     }   }); }  render() {   return (     <field       name={this.props.placeholdertext}       component={textinput}       onchange={this.handleinput}     />   ); }  const textinput = (field) => {   return (     <div classname="drill-creation-input">       <input         {...field.input}         type="input"         onchange={e => field.input.onchange(e.target.value)}       />        <label htmlfor={field.input.name}>         <span>{field.input.name}</span>       </label>     </div>   ); }; 

onchange handler has following signature (see docs)

onchange : (event, newvalue, previousvalue) 

so read complete value, define handleinput like:

handleinput = (evnt, textentered) => {   console.log(textentered);   ... } 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -