Accepted - MajAhd/elx_validation Wiki

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

accepted

data = %{
      agreement1: "on",
      agreement2: true,
      agreement3: "true",
      agreement4: "yes",
      agreement5: "1",
      agreement6: 1,
      agreement7: "off"
}
rules = [
      %{
        field: "agreement1",
        validate: ["required", "accepted"]
      },
      %{
        field: "agreement2",
        validate: ["accepted"]
      },  
     %{       
        field: "agreement3",
        validate: ["accepted"]
      },
      %{
        field: "agreement4",
        validate: ["accepted"]
      },
      %{
        field: "agreement5",
        validate: ["accepted"]
      },
      %{
        field: "agreement6",
        validate: ["accepted"]
      },
      %{
        field: "agreement7",
        validate: ["accepted"]
      }
    ]


ElxValidation.make(data , rules)