Prevent Forms from displaying validation error message.

I’ve decided to display form validation error message myself as a large floating text:

	void save() {
		try {
			this.commit();   // Change the user object bound to this form.
		} catch (InvalidValueException e) {
			// Failed to commit. The validation errors are automatically shown to the user (and that's my problem...)
			getWindow().showNotification(e.getMessage());  // Plus shown explicitely by me.
			return;
		}
		User user = (User)((BeanItem)this.getItemDataSource()).getBean();  // get that user object.
		try {
		    userDao.save(user);
...

And it works fine.
But the same message is automatically displayed by the Form component at the bottom of the form. How to disable that behavior? I traced the source code and I fall in the paint method of the validator exception (InvalidValueException). But I’m too novice to see how to prevent that paint from happening.

Optional question: how to make that validation message be displayed somewhere else in my layout?

Has anybody a good idea for me ? :rolleyes:

Hi John,

I didn’t have time to test this, but if I read the code correctly you should be able to hide the validation messages by doing

form.setValidationVisible(false);
form.setValidationVisibleOnCommit(false);

This
should
prevent the validation messages from being shown, but as I said I haven’t tested it…

/Jonatan

It works, thank you Johnatan!

Line 2 is enough (probably thanks to the defaults).

setValidationVisibleOnCommit(false);