Valitron not using custom error message

  • Andrea
  • Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
7 years 3 months ago #120768 by Andrea
Hello Tuan, first of all, HAPPY 2019.

I've setup some custom validation rules for my fields, like this one:

Valitron\Validator::addRule('check_acsi', function($numero_tessera, $valore, array $params, array $fields) {
if($valore=='')
return false;


if($valore[0]!= 1)
return false;

return true;

}, 'Il numero della tessera ACSI-FaiTango! non è corretto.');

What I notice is that the validation, when false, does not use my custom error message, but uses a "standard" error message in English, or an error message (always the same) I specify in the field definition.

This is a problem, because for every field I have different server validation rules, and each one shall produce his error message, to help the user set it up correctly.

I suspect that the validation rules code has a litlle problem, in that it doesn't use the custom error message, but always use the one specified in the fields' setup.

How can we resolve it ?

Thanks!

Regards Andrea.

Visit my page! www.elementotango.it

Please Log in or Create an account to join the conversation.

More
7 years 3 months ago #120770 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Valitron not using custom error message
Hi Andrea

That's not correct to me. Events Booking, actually not using Valitron error message. It uses the error message which you setup for your field, if you don't have error message setup at the field level, the generic error message EB_FIELD_IS_INVALID will be used

If it does not work like that on your site, you can submit a support ticket sending us super admin account of your site and tell us what we need to do to see the error. We will check to see why the issue happens and get it sorted

Regards,

Tuan

Please Log in or Create an account to join the conversation.

  • Andrea
  • Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
7 years 3 months ago #120780 by Andrea
Replied by Andrea on topic Valitron not using custom error message
Hi Tuan,

thank-you for the quick reply. Maybe I did not understand the function correctly. I checked the documentation here:

eventbookingdoc.joomservices.com/basic-s...eld-data-server-side

and the examples provided show a custom error message into the validation rules, i.e. two different error messages for 2 different rules setup.

If you say that only the "static" error message will be used, I will live with that, but in my opinion it does a less-than-perfect job at indicating what the error is. The field could be wrong because of the lenght, of the formatting, of the logic, etc etc and a unique error message is not helping the user, in my opinion.

Thanks!

Regards Andrea.

Visit my page! www.elementotango.it

Please Log in or Create an account to join the conversation.

More
7 years 2 months ago #120802 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Valitron not using custom error message
Hi Andrea

At the moment, we only use default error message, so please edit the custom field, set the error message into Validation error message parameter and it will be used

I will see if I can improve it to use the error message returned by the rule in the future

Tuan

Please Log in or Create an account to join the conversation.

  • Andrea
  • Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
7 years 2 months ago #120829 by Andrea
Replied by Andrea on topic Valitron not using custom error message
Hi Tuan,

yep will do so. Thanks Tuan.

Kind Regards Andrea.

Visit my page! www.elementotango.it

Please Log in or Create an account to join the conversation.

Moderators: Tuan Pham Ngoc