I have a big problem, this object appears to me as undefined when it is called from the input text First Name
class FormularioDeInscripcion extends React.Component{
constructor(props){
super(props);
this.state = {nombre:"",primerApellido:"",segundoApellido:"",correo:"",tipoDocumento:"",documento:""};
this.actualizarEstado = this.actualizarEstado.bind(this);
}
listaTipoDeDocumento =
<select>
<option value="CC">Cédula</option>
<option value="CE">C. Extrangería</option>
</select>;
primerNombre = React.createElement(
"input",
{type:"text",id:"primerNombre",name:"primerNombre",className:"estiloTxt", onChange:this.actualizarEstado}
);
segundoNombre = React.createElement(
"input",
{ type:"text", name:"segundoNombre", id:"segundoNombre", className:"estiloTxt",onChange:this.oe}
);
actualizarEstado(event){
alert(this.state.nombre);
if(event.target.id === "primerNombre")
{
alert("joeeee");
}
}
render(){
return(
<form onSubmit={this.actualizarEstado}>
{this.primerNombre} Primer Nombre <br></br>
{this.segundoNombre} Segundo Nombre <br></br>
<input type="text" name="primerApellido" id="primerApellido" onChange={this.actualizarEstado}></input> Primer Apellido <br></br>
<input type="text" name="segundoApellido" id="segundoApellido"></input> Segundo Apellido<br></br>
<input type="email" name="correo" id="correo"></input> Correo<br></br>
<input type="numeric" name="tarjetaProfesional" id="tarjetaProfesional"></input> Tarjeta Profesional <br></br>
{this.listaTipoDeDocumento} Tipo Documento: <br></br>
<input type="numeric" name="numeroDocumento" id="numeroDocumento"></input> Numero Documento <br></br>
<input type="submit" value="Enviar"/>
</form>
);
}
}
It works correctly from other fields that are not created with React.createElement, but with these this remains as undefined.