-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Majid Ahmaditabar edited this page Dec 10, 2021
·
9 revisions
example_data = %{
first_name: "Majid"
}
rules = [
%{
field: "first_name",
as: "first name",
validate: ["required", "string", "max:128"].
},
]
- field : The Field name that need to validate
- as : its optional and use for response error
- validate : list of rules and validations
ElxValidation.make(example_data , rules)
if it has error:
%{
errors: [
name: ["Error Message" , "Error Message"]
],
failed: true
}
Or if it hasnt error :
%{
errors: [],
failed: false
}