This library is useful for validating input forms (register / login / ...) to your web applications.
Find inspiration in validation example repository or live demo.
def deps do
[
{:validatex, "~> 1.0.1"}
]
end
If you want to use this library you have to define a few functions:
- Initialize of form state
- Define Validators
- Define form in template
- Define handle_event for
on_blur
event - Define handle_event for
on_change
event - In case of related two input forms (e.g. for password (P) and confirm password (CP)) is needed also define
handle_event
functions foron_blur
(P) andon_change
(P, CP) events. - For form event
phx_submit
define handle_event function where you'll callValidation.validate_on_submit
function for eachfield_name
of your input form and thenValidation.submit_if_valid
.
-
Pros
- per input form live validation
- possibility define own validation functions
- possible using at Scenic
-
Cons
- it isn't directly connected to Ecto
-
Comparison
Code is licensed under the BSD-4-Clause.