Validation examples

Hi,
would someone be kind enough to share some validation examples using the servoy.GlobalMethodValidator? I could not find examples in the 3.5 documentation or in the forum.
Is a separate global method needed for every field that has to be validated? What is the advantage over e.g. a onDataChange method?
Furthermore, how should error handling be done? I would like to display custom error messages to the user (also when using the regex, email, etc. validator)?

Thanks,
Reto

There was a good presentation at ServoyWorld about this topic, you can download the presentation and sample file here:

http://servoy.com/generic.jsp?mt=396&taxonomy_id=777

Thanks Jan,
this is really a great presentation/sample solution! I already tried to check it out once before, but I seem to have messed up, when I downloaded the file in Sean Devlin’s post and couldn’t import the solution :( Now it works fine and I got a lot of great input.

Right now it leaves one big question for me (I’m sure others will come, when I try to work some of the stuff into my solution). Is it possible to make error messges on column validation more user friendly? If not, I will probably have to stick with record and transaction validation…

Thanks again,
Reto

With Servoy’s errorhandler you can create custom messages. To get started:

  1. create a global method name it eg errhndlr attach that to the on error method of your solution properties
  2. in that method click move sample on isServoyException of the ServoyException object
  3. in the output window or by using breakpoints you can now see what messages/codes are coming in and you can use those to write your own error dialogs or logging.

Unfortunately, it looks like rollback is not working anymore like before.

See Rollback doesn't work as before since version 3.5.4/3.5.5 - Classic Servoy - Servoy Community

That makes the validation using table events not so useful anymore.

martinh:
Unfortunately, it looks like rollback is not working anymore like before.

See Rollback doesn't work as before since version 3.5.4/3.5.5 - Classic Servoy - Servoy Community

That makes the validation using table events not so useful anymore.

One of our engineers is looking into that