Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Form Validation and Error Messages
Form Validation and Error Messages [message #1780788] Sat, 27 January 2018 09:58 Go to next message
Peter Pfeifer is currently offline Peter PfeiferFriend
Messages: 211
Registered: November 2014
Senior Member

Hello there,

I was wondering if it's somehow possible to have the default behaviour of form validation changed?

Instead of showing a dialog box with which fields where not entered properly (as shown in the screenshot 1), I'd like to decorate the the affected fields by setting an error state (screenshot 2).

Is this somehow possible to achieve with already available methods (by overriding the appropriate methods)?

Thanks a lot,

Peter
Re: Form Validation and Error Messages [message #1780837 is a reply to message #1780788] Mon, 29 January 2018 06:54 Go to previous message
Patrick Bänziger is currently offline Patrick BänzigerFriend
Messages: 69
Registered: September 2011
Member
Hello Peter

You can validate single fields in which the user can enter values (AbstractValueField) by overriding execValidateValue.
If you throw a VetoException, the field will appear with a red exclamation mark and the message of the exception will be shown to the user if he clicks on it.
Also, the message will be shown when the whole form is validated (like the fields that are configured mandatory as in your screenshot).

For more complex field validations, you can use the various "...ErrorStatus" methods, that can also supported non-value fields (depending on the field in the end).
For example, you can inform the user about an unknown country code by creating a subclass of IErrorStatus with the severity "warning", and calling addErrorStatus. Note: Only a severity of "Error" will block the form from being saved.
(To remove it - and here comes the relevance of your own subclass - you call removeErrorStatus with the class of your custom error.)

For validation that is not field-based, you can either override execValidateForm on the form itself, or on your handler (if you need several strategies depending on your handler).

Regards,
Patrick
Previous Topic:Scout - Maven - Configure animal sniffer plugin to use java 8?
Next Topic:[7.0.300.001] [BUG] ListBox not working in Wizard
Goto Forum:
  


Current Time: Tue Nov 13 20:22:14 GMT 2018

Powered by FUDForum. Page generated in 0.02083 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top