Allow IsValid to accept min argument without a max value

Hi, guys!

I’m developing my portfolio in CFML/Lucee and I ended up finding one behaviour that I found strange. I was using isValid() to check if a value is integer and is greater than 0. So, I tried the code below, but it didn’t work:

if (isValid(type="integer", value=pid, min=1)) {
     // rest of the code
}

I got an error from lucee engine saying that: invalid call of the function isValid, first Argument (type) is invalid, wrong attribute count for type [integer]

When I define a max argument, it works. The problem is that I don’t want to set a max value. I just wanted to make sure the minimum value is respected.

So I think would be interesting to make max argument optional in this function, only for the situations when we really want to make a range validation.

What do you think about it?

PS.: My solution for now was this:

if (isValid(type="integer", value=pid) AND pid GT 0) {
     // rest of the code
}

just pid GT 0 is enough in this case, cfml automatically does the casting

as does isValid internally

Got it!

Thanks a lot.