GlobalMethodValidator

Hi,

I’m using Servoy’s global method validator to validate my email addresses.
However, if I entered an address of a wrong type and then deleted the input it won’t let me out of the field until i type some valid email.
Is it the default behaviour and is there a way to override it?

Also, I would like to give my own error message but Servoy pops something like ‘Invalid input. Validation failed for ‘emailaddress’ , with value: ‘asdf’’

Thanks for your help,
Maria

Maria,

Basically, Servoy assumes the data cannot be stored in the dataProvider when validation fails and therefore the user cannot leave the field.
This is the same with numeric fields where the user enters non-numeric data.

In the smart-client, the user can use the escape key to restore the original (valid) value.

In your case, you could have the global method validator return true even if the email address is invalid, but set another global error message which is displayed on your form.
This is similar to doing a check in the onDataChange of the field.

For safety you could check again in the OnRecordInsert/Update triggers to make sure no invalid email addresses ever get saved.

Note that in Servoy 5, the OnRecordUpdate/Insert/Delete triggers may throw an exception which can be retrieved via record.exception.getValue() of dbmgr.getFailedRecords().

Rob

rgansevles:
Maria,

Basically, Servoy assumes the data cannot be stored in the dataProvider when validation fails and therefore the user cannot leave the field.
This is the same with numeric fields where the user enters non-numeric data.

In the smart-client, the user can use the escape key to restore the original (valid) value.

In your case, you could have the global method validator return true even if the email address is invalid, but set another global error message which is displayed on your form.
This is similar to doing a check in the onDataChange of the field.

For safety you could check again in the OnRecordInsert/Update triggers to make sure no invalid email addresses ever get saved.

Note that in Servoy 5, the OnRecordUpdate/Insert/Delete triggers may throw an exception which can be retrieved via record.exception.getValue() of dbmgr.getFailedRecords().

Rob

Thanks Rob.
We’re migrating to Servoy 5 and appreciate useful hints :)