Validation Rules on $_POST variables doesn't work? or is it me

Hey All,

I get this a lot and i usually just end up disabling the sever side validation and just rely on front-end form validation, but thought it about time I post here.

I get this a lot, mainly when dealing with number inputs, where the server side validation in terms of minimums and maximums just doesn’t work… in that I ask for a number greater than 0 as the only rule, and it fails for any number actually greater than 0.

Example:
Here is the validation, imported when i imported the fields from the form.

Here is the validation error on the front-end:

image

In the form, the input is being sent through as a number:

image

But the validation just isn’t right… clearly 10 is a number greater than 0.

If i remove the server side validation the form works. The front end validation will still give an error for numbers less than 0, but anything greater will be submitted as per normal.

Is this a bug? Is there something i’m missing here?

Here is part of input, it is currently set as type=text…but I have the same issue if I use type=number:

<input id="day_shrinkage" name="day_shrinkage" class="form-control form-control-sm" data-rule-number="" min="0" data-rule-min="0" data-msg-min="Please enter a value greater than or equal to 0" required="">

Maybe related to these

Thanks Ken, I’ll have a look…but a quick glance seems these are still unresolved bugs?

Yep, just pulling them in as there might be one fix.

I did try to remove the default HTML min="0" and leave just the Wappler data-rule-min="0" as suggested in the other post, but it didn’t help.

Looks like this bug is still very much alive…which is strange as it would be a quite a large bug effecting lots of people if so?? strange…

Have you tried converting the value to a number?

As an example, I has to convert a date to a date as in

The client-side min/max validation was fixed not long ago, it is possible that the server-side validation still contains the bug. What do you use server-side (node/php/asp)?

This is a Node JS project. I haven’t yet tested the converting to a number as per Ben’s suggestion, but the source data is being posted in number format from the browser as per one of screen shots

Just confirming that converting to a number in Server Connect did not solve the issue.

Only solution is to turn off server side validation and rely on client side

You should not have to turn off the server side validation. I have a faint suspicion that there may be an unwanted character (Wappler induced) or similar in the code.

Try creating deleting the API action and re-creating using the same info.