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"}
]
endIf 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_blurevent - Define handle_event for
on_changeevent - In case of related two input forms (e.g. for password (P) and confirm password (CP)) is needed also define
handle_eventfunctions foron_blur(P) andon_change(P, CP) events. - For form event
phx_submitdefine handle_event function where you'll callValidation.validate_on_submitfunction for eachfield_nameof 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.

