To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.
Form like validation errors on screen without form
1 decade ago Jan 27, 2011 9:37pm
Hi, I want to display form like validation failure messages without actually a form and also without setting required error on the field. Is there an easy way to do that manually based on some logic? I don't want to use window notifications.
Sure. When you validate a component with validate(), failure results in an exception which you can catch and display in a Label component, for example.
If you use setRequired(true), the field will throw EmptyValueException if it is empty when validating. You can catch it and handle as you like, without setting the error message with setRequiredError().