-1

How do I get the value from a textfield on focus out. Let's say I have a textfield. I type something and click somewhere outside. I need to get the value from textfield. I only see onChanged property in the documentation which would store each time when a character is added to the textfield which is not what I am looking for.

user989988
  • 3,006
  • 7
  • 44
  • 91

1 Answers1

1

Maybe this codepen https://codepen.io/vitalius1/pen/MZqoWo can help you. The onBlur prop exists on TextFiled. It's prop interface ITextFieldProps is extending from React.AllHTMLAttributes<HTMLInputElement | HTMLTextAreaElement> so all input native props are present on TextField even if it's not obvious right away.

To grab the value on the other side you could use the getter method value through the componentRef prop or access the event.target.value in the onBlur callback. Both are shown in the codepen.

Vitalie Braga
  • 476
  • 2
  • 3