• Resolved shawnm1

    (@shawnm1)


    I’m trying to invalidate a text input field with the following regular expression in the forumla builder:

    var regex = /[a-z]/;
    regex.test(field);

    For this particular use, I need it to reject all letters. I’d use a number field, but I need leading zeros. Any idea why this code doesn’t work?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author EDGARROJAS

    (@edgarrojas)

    mmm i think that would be true only if the letters are lowercase, maybe something like this:

    var regex = /[a-zA-Z]/;
    regex.test(field);

    Doesn’t seem to matter either way. It seems like it just ignores the validation check entirely. Upper/lower case doesn’t affect it, numbers don’t affect it. I tried adding the ignore case flag, no difference.
    I know the js is correct, but it’s like smart forms doesn’t see it for some reason. Do I need to enable something somewhere else for it to use formulas?

    Do I need to put this in the JavaScript tab instead of the conditional logic formula builder?

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.