I was going through fabric UI TextField documentation(https://developer.microsoft.com/en-us/fluentui#/controls/web/textfield ) . I tried few examples of TextField with the following two handlers:-
- onChange
- onGetErrorMessage.
I tried few experiments with these two handlers (https://codepen.io/nishchay271095/pen/rNyPKYY?editors=1011 ):-
Case 1. When using both the handlers without any extra properties of TextField, both handlers(onChange and onGetErrorMessage) are called.
<TextField
label="Controlled TextField"
onChange={onChangeSecondTextFieldValue}
onGetErrorMessage = {onGetErrorMessageHandler}
/>
Case 2. When using both handlers with "defaultValue" property, both handlers(onChange and onGetErrorMessage) are called.
<TextField
label="Controlled TextField"
defaultValue = "hello"
onChange={onChangeSecondTextFieldValue}
onGetErrorMessage = {onGetErrorMessageHandler}
/>
Case 3. When using both handlers with "value" property of TextField, only onChange() handler was called.
<TextField
label="Controlled TextField"
value="hello"
onChange={onChangeSecondTextFieldValue}
onGetErrorMessage = {onGetErrorMessageHandler}
/>
Now, I'm having following doubts:-
- Why onGetErrorMessage() is not being called in case 3?
- How value and defaultValue properties affect the behavior of these two handlers(onChange and onGetErrorMessage)?