ElxValidation.Max (elx_validation v0.1.3)

max:value

  • The field under validation must be less than or equal to a maximum value.Strings and numerics are evaluated in the same fashion as the size rule.
data = %{
    name: "john",
    age: 20
}
rules = [
    %{
      field: "name",
      validate: ["max:10"]
    },
    %{
      field: "age",
      validate: ["max:40"]
    }
  ]

Link to this section Summary

Functions

check value max size

Link to this section Functions

Link to this function

is_maximum(target, value)

check value max size

  • max : 10 / value 9 -> passed
  • max : 3 / value "hi" -> passed (hi is 2 char < 3)
  • value is string and convert to number