npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cleverform

v0.1.2

Published

CleverForm is a JavaScript library for fast, straightforward and elegant HTML form validations.

Readme

cleverform.js

CleverForm is a JavaScript library for fast, straightforward and elegant💕 HTML form validations

📜 Visit cleverform.org for official documentation.

Introduction

Cleverform is a javascript library for elegant💕 and easy to use form validation.

It's a 1 stop shop javascript library that handles all forms related functionality such as field validations, displaying of field errors in the DOM, Field CSS class Injections depending on the field status (success/with error), serializing validated field data, and many more!

Why cleverform?

“ We all find the good parts in the products that we use.We value simplicity, and when simplicity isn’t offered to us, we make it ourselves.

Javascript alone has no built-in form validation functionalities.

Implementing your form validation from scratch is very cumbersome and it consumes a lot of time in your development.

That's why CleverForm library exists!

In just a few minutes, you can implement form validations.


Easy to understand

JavaScript beginners can easily understand the library API.

Zero JS dependencies

No need to add other javascript libraries.

CSS library adaptable

Can work with different CSS libraries such as bootstrap , Foundation , Bulma and many more.

Short code

Form validation in just a few lines of codes.

✅ Built-in validation rules

CleverForm has many built-in validation rules that you can use like required, minLen, and many more!

✅ Custom validation rules

If there are no built-in rules that will suffice your need, you can add your own validation rules with your logic in easy to understand syntax.

Form security

The cleverform handle form securities such as not allowing form users to forcibly submit a form via the browser’s console :

//Example of forcing to submit first form in the DOM and it ignore any kind of form validations 
document.forms[0].submit()

But by using CleverForm, this vulnerability is solved.

Sample Usage

For more details about installations and implementation, visit cleverform.org for official documentation.

👉 Create your form

Below is the html code for the form where we will add form validation using Cleverform.

<form method="POST" id="registrationForm" >

    <div class="row">
        <label for="f_name">First name</label>
        <div >
            <input type="text" class="field" id="f_name" name="f_name">
            <!-- The div tag below will hold the error message of the field. -->
            <div cf-msg="f_name"></div>
        </div>
    </div>

    <!-- Last name and Other fields here ... -->
    <!-- Submit button here... -->

</form>


<!-- Import cleverform -->
<script src="/your-path/cleverform.dev.js" ></script>

👉 Instantiate your form

Below is a simple way of implementing form validation using CleverForm constructor function. CleverForm does every field's validation under the hood.

const regForm = new CleverForm({

    // The id of the html form
    id: "registrationForm",

    // The validation rules per field's name, multiple rules are seperated by pipe '|'
    rules: {
        f_name: "required | minLen:2 | maxLen:50",
        l_name: "required | betweenLen:2,50",
        //...
    },

    formEvents: {

        // onSuccess event  hold a callback function/event listener
        // that will run when the form is submitted with out validation errors
        
        onSuccess: function(validatedData) {

            //submit validatedData here via http request in the server
            console.log("Success, Form has No validation error. Submit data via http request in the server (ex: via AJAX , fetch and axios)");
            console.log("validatedData Object: ", validatedData);

        },

        // other events here...
    }

    // ...
});

That's it! 🎉

You just implemented a form validation. 👏

👉 Accessing value

Optionally, you can easily access the field's current value in the form at runtime by accessing the instance's properties.


// continuation of `regForm` instantiation above...

var firstName = regForm.f_name;
var lastName = regForm.l_name;

console.log(firstName) // prints the f_name value
console.log(lastName)  // prints the l_name value

License

MIT

Copyright (c) 2020 JC II