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 🙏

© 2024 – Pkg Stats / Ryan Hefner

quasiform

v3.0.5

Published

![quasiform logo](https://raw.githubusercontent.com/mishantrop/quasiformes6/master/src/images/logo.png?v=2018-03-25 "quasiform logo")

Downloads

1

Readme

quasiform logo

quasiform logo

quasiform

This is JavaScript library that helps submit and validate your forms. Keep your validation logic on server side, and for client side validate with javascript and AJAX. Supports multiple reCaptcha 3.

Real life examples

How to run demo locally

Install dependencies

  $ yarn

Run php server

  $ php -S 0.0.0.0:8000

Open http://0.0.0.0:8000/docs/ in browser

How to use as umd library on any website

Demo: https://quasiform.quasi-art.ru/forms/simple

<script src="https://quasiform.quasi-art.ru/assets/templates/main/js/quasiform.min.js"></script>

<script>
  var contactsForm = new quasiform({
    selector: '#contacts-form-wrapper',
  });
</script>

How to use as es-module

Install

yarn add quasiform

Add to your script

import quasiform from 'quasiform';

Init

const options = {
    selector: '#contacts-form',
    hideFormOnSuccess: false,
};
const quasiformContacts = new quasiform(options);

Add some HTML to your page

<div id="post" class="quasiform-wrapper">
  <div data-quasiform="errors" style="display: none;" class="quasiform-errors"></div>
  <div data-quasiform="messages" style="display: none;" class="quasiform-messages"></div>
  <div data-quasiform="loader" style="display: none;" class="quasiform-loader"><i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i></div>
  <div data-quasiform="html" style="display: none;" class="quasiform-html">
    <!-- HTML response will be here-->
  </div>
  <form action="post.php" method="post" accept-charset="utf-8" enctype="multipart/form-data" class="quasiform-form">
    <div class="row">
      <div class="col m6 s12">
        <div class="quasiform-form__form-group">
          <label for="name" class="quasiform-form__label">Name</label>
          <input id="name" type="text" name="name" value="Vasya" placeholder="Имя" class="quasiform-form__input">
        </div>
      </div>
    </div>
    <div class="quasiform-form__form-group">
      <label class="quasiform-form__label--checkbox">
        <div data-quasiform="checkbox" data-name="checkbox-agree" data-quasiform-checkbox-off="quasiform-form-checkbox--off" class="quasiform-form-checkbox"><i class="fa fa-check"></i></div>
        <input type="checkbox" name="checkbox-agree" value="1" data-quasiform="agreement" checked="" style="display: none;">Agree
      </label>
    </div>
    <div class="quasiform-form__form-group">
      <button type="submit" class="quasiform-form__submit">Send</button>
    </div>
  </form>
</div>

Options

debug

Default: false

errorOpenTag

Defaut: <li>

errorCloseTag

Defaut: </li>

errorsOpenTag

Defaut: <ul>

errorsCloseTag

Defaut: </ul>

messageOpenTag

Defaut: <li>

messageCloseTag

Defaut: </li>

messagesOpenTag

Defaut: <ul>

messagesCloseTag

Defaut: </ul>

hasErrorInputClass

Defaut: quasiform__form-input--has-error

hasErrorLabelClass

Defaut: quasiform__form-label--has-error

callbackOnSuccess

Callback function to be invoked after the form has been submitted. If a success callback function is provided it is invoked after the response has been returned from the server.

callbackOnFail

Callback function to be invoked upon error.

File Uploads

The Form Plugin supports use of XMLHttpRequest Level 2 and FormData objects on browsers that support these features.

Screenshots

Custom checkbox

Report, part 1

Loader

Loader

Error messages

Error messages

Star rating

Star rating

Success response

Success response

Initialization

JavaScript

let optionsPost = {
    debug: true,
	selector: '#post',
    hasErrorInputClass: 'has-error',
    hasErrorLabelClass: 'has-error',
    hideFormOnSuccess: false,
    callbackOnSuccess: function callbackOnSuccess(wrapper) {
        console.debug(wrapper);
    },
    callbackOnFail: function callbackOnFail(wrapper) {
        console.debug(wrapper);
    },
};
let quasiformPost = new quasiform(optionsPost);

HTML

<div id="post" class="quasiform-wrapper">
	<div data-quasiform="errors" style="display: none;" class="quasiform__errors"></div>
	<div data-quasiform="messages" style="display: none;" class="quasiform__messages"></div>
	<div data-quasiform="loader" style="display: none;" class="quasiform__loader">
		Я отправляю форму
	</div>
	<form action="post.php" method="post" accept-charset="utf-8" class="quasiform__form" enctype="multipart/form-data">
		<div class="quasiform__form__form-group">
			<label for="text" class="quasiform__form-label">Сообщение</label>
			<textarea id="text" name="text" placeholder="Ваше сообщение" class="quasiform__form-textarea">Hello</textarea>
		</div>
		<div class="quasiform__form__form-group">
			<button type="submit" class="quasiform__form-submit">Отправить</button>
		</div>
	</form>
</div>

Server response

{
	"errors": ["Error 1", "Error 2"],
	"messages": ["Message 1", "Message 2"],
	"success": true
}

Roadmap

  • Clear form after submit.
  • Demo of multiple recaptcha
  • Detect offline
  • Check if response is not json
  • Customization of Spinner
  • Customization of Star Rating
  • Customization of File Input