NumberRangeValidator not displaying correctly TiNG

Forum to discuss the new web client version of Servoy.

NumberRangeValidator not displaying correctly TiNG

Postby rafig » Thu Sep 12, 2024 8:22 pm

Hi,
I just tried adding some range checking to some columns in a Servoy 2024.3.2.3945 solution running in TiNG.
When I test the solution & enter a value outside the range defined, the following Toastr appears, but is obviously not picking up the correct parameters from somewhere...
NumberRangeValidator Toastr.png

I couldn't see anything in support system & I can't see how to do anything with the 'servoy' method.
This is this first time I am trying to use this, so I could be doing something stupid, but don't know what??
(I know I can code my own global method, but this should be the easiest way of doing it surely...)

Thanks

Rafi
You do not have the required permissions to view the files attached to this post.
Servoy Certified Developer
Image
rafig
 
Posts: 724
Joined: Mon Dec 22, 2003 12:58 pm
Location: Watford, UK

Re: NumberRangeValidator not displaying correctly TiNG

Postby rafig » Fri Sep 27, 2024 9:29 am

^^^ BUMP ^^^

Anyone?????
Servoy Certified Developer
Image
rafig
 
Posts: 724
Joined: Mon Dec 22, 2003 12:58 pm
Location: Watford, UK

Re: NumberRangeValidator not displaying correctly TiNG

Postby mboegem » Fri Sep 27, 2024 10:17 am

Hi Rafi,

it would help if you can share more information about your solution and the code that is involved.
Basically all that can be done right now is for someone to reproduce your problem and come up with either solution or confirmation of a Servoy-bug on your problem.
Time is limited though ;-)

Looking forward to more info
Marc Boegem
Solutiative / JBS Group, Partner
Servoy Specialist
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image
User avatar
mboegem
 
Posts: 1817
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: NumberRangeValidator not displaying correctly TiNG

Postby rafig » Fri Sep 27, 2024 6:34 pm

Thanks for replying Marc (as you seem to do for SO many people ;-) )
It is such a simple solution.
I basically took the Servoy (Cloud) Sample solution as a framework then added some of my own forms and my client is entering patient data, in this case either height or weight values in imperial or metric
into these boxes on a form
Form Fields.png

and then I just added on the database table some 'Validation'
Validation.png

and that is it!
When running and incorrect values are entered in box, that dialog appears.
There are no other event methods added to the boxes.
I hope this is enough info, not sure what else might be needed ;-)
Thanks
You do not have the required permissions to view the files attached to this post.
Servoy Certified Developer
Image
rafig
 
Posts: 724
Joined: Mon Dec 22, 2003 12:58 pm
Location: Watford, UK

Re: NumberRangeValidator not displaying correctly TiNG

Postby paronne » Mon Sep 30, 2024 9:38 am

Hi Rafig,

which version of the svyUtils module are you using ?
Base form in sample solution is concatenating error markers from validations; using also svyValidationUtils from the svyUtils module.
This code snippet is the one creating the message

Code: Select all
function getMessageFromMarkers(markers, separator) {
   if (!separator) separator = "\n";

   var errorMsgs = [];

   for (var i = 0; i < markers.length; i++) {
      var errorMarker = markers[i];
      errorMsgs.push(errorMarker.i18NMessage);
   }

   return errorMsgs.join(separator);
}


I have tried on version 2024.3.3 and works just fine.

Image20240930103708.png
You do not have the required permissions to view the files attached to this post.
paronne
 
Posts: 217
Joined: Fri Nov 02, 2012 3:21 pm

Re: NumberRangeValidator not displaying correctly TiNG

Postby rafig » Mon Sep 30, 2024 4:55 pm

paronne wrote:which version of the svyUtils module are you using ?

As far as I can see, the latest version, 2024.3.0
Installed Version.png

paronne wrote:Base form in sample solution is concatenating error markers from validations; using also svyValidationUtils from the svyUtils module.
This code snippet is the one creating the message
Code: Select all
function getMessageFromMarkers(markers, separator) {
   if (!separator) separator = "\n";
   var errorMsgs = [];
   for (var i = 0; i < markers.length; i++) {
      var errorMarker = markers[i];
      errorMsgs.push(errorMarker.i18NMessage);
   }
   return errorMsgs.join(separator);
}


BUT, that method is not in my module and I can see it on the GitHub page, but not in my local code
Validation Methods.png

paronne wrote:I have tried on version 2024.3.3 and works just fine.

As I stated in my 1st post, this solution is on Servoy 2024.3.2, not 2024.3.3, but I thought the web packages would be ok with a minor version difference like that??
And is there anything else I need to do on my forms/fields to make them call these 'validation methods', as I'm not explicitly calling them (& with all due respect, once again, the online docs/wiki have no information on this [svyValidationUtils nothing on this page https://github.com/Servoy/svyUtils/wiki ]
Where or how should I be calling something if I need to??
Thanks

Rafi
You do not have the required permissions to view the files attached to this post.
Servoy Certified Developer
Image
rafig
 
Posts: 724
Joined: Mon Dec 22, 2003 12:58 pm
Location: Watford, UK

Re: NumberRangeValidator not displaying correctly TiNG

Postby paronne » Fri Oct 11, 2024 4:38 pm

Hi Rafig,

i can now see why is showing the {{0}} in your validation message.
The onElementDataChange in the baseCRUD of sample solution was showing in a toastr the marker message.
Code: Select all
function onElementDataChange(oldValue, newValue, event) {
   var markers = validate(event.getSource());
   if (markers && markers.length) {
      // show error message
      plugins.webnotificationsToastr.error(markers[0].message);
   }
   return true
}


It should show instead the i18nMessage of the marker where placeholders {{0}}.. are replaced with actual values ( dataproviderName, minLimit, maxLimit ).

Code: Select all
plugins.webnotificationsToastr.error(markers[0].i18NMessage);


The svyValidationUtils i mentioned before is parsing the error markers upon save. If you try to save i believe you see the message correctly as in my previous screenshoot.
This is build around the Servoy core Validations https://docs.servoy.com/guides/develop/ ... validation. Any validation error is returning a validation marker. The svyValidationUtils are some simple utilities function used to parse multiple error marker messages into a single message.

Regards,
Paolo
paronne
 
Posts: 217
Joined: Fri Nov 02, 2012 3:21 pm

Re: NumberRangeValidator not displaying correctly TiNG

Postby rafig » Mon Oct 14, 2024 7:39 pm

paronne wrote:Hi Rafig,
It should show instead the i18nMessage of the marker where placeholders {{0}}.. are replaced with actual values ( dataproviderName, minLimit, maxLimit ).
Code: Select all
plugins.webnotificationsToastr.error(markers[0].i18NMessage);

Paolo

Thanks Paolo, that fixed it!
Servoy Certified Developer
Image
rafig
 
Posts: 724
Joined: Mon Dec 22, 2003 12:58 pm
Location: Watford, UK


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 5 guests