You can download the latest /dist code directly from our GitHub repository v0.0.4-alpha (latest).

Don't forget to give us a ⭐ if you think FormaJS is worthwhile and we should continue improving on it.

Custom Client-side Validation Errors

In addition to the built-in client-side vaildation errors you can add your custom validations with error messages by using the pattern and title attributes.

CSS

Using a custom CSS stylesheet build on top of the forma-boilerplate.css template. Take a look at the code on our GitHub repository.

HTML

<form class="forma">
  <input data-label="Email Address" type="email" name="email-address" pattern="([0-9A-Za-z_@.]+)"
    title="Email address must contain digits, letters, and @_. characters." required />
  <input data-label="First Name" type="text" name="first-name" minlength="3"pattern="([A-Za-z ]+)"
    title="First name must contain letters only." required />
  <input data-label="Last Name" type="text" name="last-name" minlength="3" pattern="([A-Za-z ]+)"
    title="Last name must contain letters only." required />
  <textarea data-label="Message" rows="5" name="message" required  maxlength="400"></textarea>
  <button type="submit">Send</button>
</form>

JavaScript

forma({ 
  submit: true,
  auto: true
});