Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

380
Views
Validar el campo de texto basado en la entrada React Material Ui

¡Hola! Estoy buscando una forma de establecer un error cada vez que el valor insertado en el primer campo de texto sea diferente de "28.71", de lo contrario, configure correctamente

Mi código hasta ahora:

 class Main extends React.PureComponent { render() { return ( <Box sx={SX.root}> <Box className="textFieldWrapper"> <TextField sx={SX.textField} id="filled-number" type="number" label={this.props.settings.texts.t1} variant="outlined" size="small" style={{width: '100px'}} /> </Box> <Box className="textFieldWrapper2"> <TextField sx={SX.textField2} id="filled-number" type="number" label={this.props.settings.texts.t2} variant="outlined" size="small" style={{width: '100px'}} /> </Box> </Box> ); } } // ----------------------------------------------------------------------------------------------------------------- // INTERNAL // ----------------------------------------------------------------------------------------------------------------- // ===================================================================================================================== // EXPORT // ===================================================================================================================== export default Main;

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Usando un estado de componente de reacción, uno puede almacenar el valor de TextField y usarlo como un indicador de un error. Material-UI expone los accesorios de error y helperText para mostrar un error de forma interactiva.

Echa un vistazo al siguiente ejemplo:

 <TextField value={this.state.text} onChange={event => this.setState({ text: event.target.value })} error={text === ""} helperText={text === "" ? 'Empty field!' : ' '} />
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!