File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -159,6 +159,12 @@ class Input extends Component {
159159 ourCallbackResult = false ;
160160 break ;
161161 }
162+
163+ // Handles initial validation state (Triggered for error message)
164+ if ( this . props . validation ) {
165+ this . handleHasValidation ( ) ;
166+ }
167+
162168 if ( ourCallbackResult !== "" ) {
163169 this . setState ( {
164170 onComponentDidMountCallback : ourCallbackResult
@@ -393,10 +399,16 @@ class Input extends Component {
393399
394400 handleHasValidation ( event ) {
395401 let value = undefined ;
396- switch ( this . props . type ) {
397- default :
398- value = event . target . value ;
399- break ;
402+
403+ // Handles initial validation state, which does not include an event.
404+ if ( event ) {
405+ switch ( this . props . type ) {
406+ default :
407+ value = event . target . value ;
408+ break ;
409+ }
410+ } else {
411+ value = this . state . value ;
400412 }
401413 let validationResult = undefined ;
402414
You can’t perform that action at this time.
0 commit comments