2021年3月28日星期日

Material-ui TextField not allowing the entering of specific special characters

How can I put a validation or not allow to enter the following special characters [^%<>\\$'"] on the Material-ui TextField.

Below are my existing codes.

const useStyles = makeStyles((theme) => ({  textField: {      marginRight: theme.spacing(1),      width: 500,  },  FormLabelHeader:{      fontSize: '20px',      width: 500,  },  })  enter code here  const txtNameChange = (e) =>  {      setpersonDetails(prevState =>({          ...prevState,          'NAME' : e.target.value      }))  }    .....  <FormControl>     <FormLabel className = {style.FormLabelHeader}>Add</FormLabel><br/>     <TextField className = {style.textField} label='NAME' name = 'NAME' variant='outlined' autoComplete='off' onChange={txtNameChange}/><br />  </FormControl>  
https://stackoverflow.com/questions/66848152/material-ui-textfield-not-allowing-the-entering-of-specific-special-characters March 29, 2021 at 10:41AM

没有评论:

发表评论