ifs-web-service/ifs-web-core/src/main/java/org/innovateuk/ifs/util/ThymeleafUtil.java
//You can find the form (beanName) from the request context but I can't figure out how atm.
You can find the form (beanName) from the request context but I can't figure out how atm.
You can find the form ( beanName ) from the request context but I can ' t figure out how atm .
public boolean hasErrorsStartingWith(String form, String startsWith) {
        final IThymeleafRequestContext requestContext = SpringContextUtils.getRequestContext(context);
        Optional<Errors> maybeErrors = requestContext.getErrors(form);
        if (maybeErrors.isPresent()) {
            Errors errors = maybeErrors.get();
            return errors.getFieldErrors().stream()
                    .anyMatch(error -> error.getField().startsWith(startsWith));
        }
        return false;
    }
public boolean hasErrorsStartingWith ( String form , String startsWith ) { final IThymeleafRequestContext requestContext = SpringContextUtils . getRequestContext ( context ) ; Optional < Errors > maybeErrors = requestContext . getErrors ( form ) ; if ( maybeErrors . isPresent ( ) ) { Errors errors = maybeErrors . get ( ) ; return errors . getFieldErrors ( ) . stream ( ) . anyMatch ( error -> error . getField ( ) . startsWith ( startsWith ) ) ; } return false ; }
You can find the form (beanName) from the request context but I can't figure out how atm.
You can find the form ( beanName ) from the request context but I can ' t figure out how atm .