Skip to main content
abhayg0001
New Participant
May 9, 2021
Question

validate number without using regex

Hi All,

Is there any way to validate number without using regex.

Here is the requirement,

Need to enter  only number upto 15-18 character. I can't use here integer or floating-point field so I am using textbox with regexmatch function to validate but my requirement to not use regexmatch function.

Is there any way to achieve this ?

    3 replies

    natashan0002
    Inspiring
    May 9, 2021

    Hi,

    You can use stripwith.

    natashan0002
    Inspiring
    May 9, 2021

    This will return true if all entered inputs are numbers.

    isnull(
    stripwith(lower(ri!textinput), "1234567890")
    )

    furthermore you can use len() , and() to check the length.

    csteward
    Brainy
    May 11, 2021

    There are a few ways to achieve this.  Here's a working example utilizing cleanwith() to automatically remove alpha characters, and validates length of up to 18.

    a!localVariables(
      local!data,
      {
        a!textField(
          label: "Enter Data",
          value: local!data,
          saveInto: a!save(local!data,cleanwith(save!value,"1234567890")),
          validations: {
            if(
              len(local!data)>18,
              "Please enter a number up to 18 characters",
              null
            )
          }
        )
      }
    )