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…
[attachment=0]NumberRangeValidator Toastr.png[/attachment]
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…)
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
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
[attachment=1]Form Fields.png[/attachment]
and then I just added on the database table some ‘Validation’
[attachment=0]Validation.png[/attachment]
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
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
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.
paronne:
which version of the svyUtils module are you using ?
As far as I can see, the latest version, 2024.3.0
[attachment=1]Installed Version.png[/attachment]
paronne:
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
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
[attachment=0]Validation Methods.png[/attachment]
paronne:
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 Home · Servoy/svyUtils Wiki · GitHub ]
Where or how should I be calling something if I need to??
Thanks
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.
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 ).
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.
paronne:
Hi Rafig,
It should show instead the i18nMessage of the marker where placeholders {{0}}… are replaced with actual values ( dataproviderName, minLimit, maxLimit ).