Numbers - MajAhd/elx_validation Wiki

Original URL: https://github.com/MajAhd/elx_validation/wiki/Numbers

numeric

 data = %{
       number1: 2121,
       number2: "2121"  ----> return error    
    }

rules = [
     %{
        field: "number1",
        validate: ["numeric"]
      },
      %{
        field: "number2",
        validate: ["numeric"]
      }
]

digits:value

 data = %{
      age1: 12,
      age2: 9  ---> return error min 2 digit required
} 
rules = [
      %{
        field: "age1",
        validate: ["digits:2"]
      },
     %{
        field: "age2",
        validate: ["digits:2"]
      }
 ]