public void validate ( ) { formInvalid = false ; errorMsgText = null ; for ( CheckedButtonWrapper wrapper : buttons ) { if ( wrapper . button . isChecked ( ) != wrapper . mustBeChecked ) { wrapper . setButtonStateInvalid ( true ) ; } else { wrapper . setButtonStateInvalid ( false ) ; } } for ( CheckedButtonWrapper wrapper : buttons ) { if ( treatDisabledFieldsAsValid && wrapper . button . isDisabled ( ) ) { continue ; } if ( wrapper . button . isChecked ( ) != wrapper . mustBeChecked ) { errorMsgText = wrapper . errorMsg ; formInvalid = true ; break ; } } for ( VisValidatableTextField field : fields ) { field . validateInput ( ) ; } for ( VisValidatableTextField field : fields ) { if ( treatDisabledFieldsAsValid && field . isDisabled ( ) ) { continue ; } if ( field . isInputValid ( ) == false ) { Array < InputValidator > validators = field . getValidators ( ) ; for ( InputValidator v : validators ) { if ( v instanceof FormInputValidator == false ) { throw new IllegalStateException ( "Fields validated by FormValidator cannot have validators not added using FormValidator methods. " + "Are you adding validators to field manually?" ) ; } FormInputValidator validator = ( FormInputValidator ) v ; if ( validator . getLastResult ( ) == false ) { if ( ! ( validator . isHideErrorOnEmptyInput ( ) && field . getText ( ) . equals ( "" ) ) ) { errorMsgText = validator . getErrorMsg ( ) ; } formInvalid = true ; break ; } } break ; } } updateWidgets ( ) ; }
Performs full check of this form typically there is no need to call this method manually since form will be automatically validated upon field content change . However calling this might be required when change made to field state does not cause change event to be fired . For example disabling or enabling field .