Skip to content

An Elixir validation library for live view forms.

Notifications You must be signed in to change notification settings

iodevs/validatex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Validatex

Build Status

This library is useful for validating input forms (register / login / ...) to your web applications.

Find inspiration in validation example repository or live demo.

Installation

def deps do
  [
    {:validatex, "~> 1.0.1"}
  ]
end

Usage

If you want to use this library you have to define a few functions:

  1. Initialize of form state
  2. Define Validators
  3. Define form in template
  4. Define handle_event for on_blur event
  5. Define handle_event for on_change event
  6. In case of related two input forms (e.g. for password (P) and confirm password (CP)) is needed also define handle_event functions for on_blur (P) and on_change (P, CP) events.
  7. For form event phx_submit define handle_event function where you'll call Validation.validate_on_submit function for each field_name of your input form and then Validation.submit_if_valid.

Notes

  • Pros

    • per input form live validation
    • possibility define own validation functions
    • possible using at Scenic
  • Cons

    • it isn't directly connected to Ecto
  • Comparison

    • Using Validatex
    • Using changeset from Ecto

License

Code is licensed under the BSD-4-Clause.

Packages

No packages published

Contributors 2

  •  
  •  

Languages