Giter Club home page Giter Club logo

form-async's Introduction

Form Async

Build Status

Form Async is an easy-to-use library that provide acronymous sending on form changes. It's a great solution to preventing data loss when filling out a web form.

Features

  • Lightweight (~1.5kb gziped)
  • Saves any HTML form element
  • Support content editable property
  • Full customization
  • Retry functionality if ajax request fail
  • Send form elements as group of field
  • Provide the way to validate changes before sending ajax request
  • Heavily tested

Installation

$ npm install form-async

We recommend installing from npm and then using a module bundler such as RequireJS, Webpack or Browserify.

Alternatively, you can use jsdelivr CDN instead of npm.

<!-- 1. Add JS before the closing `</body>` -->
<script src="jquery.js"></script>
<script src="form-async.js"></script>

<!-- 2. Initialize -->
<form action="/ajax/account">
   <input name="xs_username">
</form>

<script>
   $("form").async();
</script>

Documentation

Read the docs for more details on how to use Form Async.

Callbacks

  • before — pre-request function that can be use to validate data before it is sent
  • success — function invoked if the request succeeds
  • error — function invoked if the request fails

Software

We use Browserstack for manual testing BrowserStack logo

form-async's People

Contributors

lognoz avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

form-async's Issues

how to submit entire form?

This is a cool little plug-in, but the page is sending via POST only the single field from the form that has changed. How do I send the entire form in the async POST? Other fields in the form are required to do security checks, etc. Thanks

Select "multiple" not working has expected with "change" event

When using a select "multiple", the "change" event is not triggered when i select multiple values from top to bottom, so selected values are not saved.
Everything is fine when selecting multiple values from bottom to top : "change" event is fired and selected values are saved.
Very strange problem ?!!!

Return response object

Would be nice to get the response object of the ajax to get the status code for example.

Two bugs

Two bugs I have encountered:

Loading a form with "textarea" filled in and then deleting the text in it to make the field empty does not trigger a save.

On iOS, filling out a form item and then clicking away to another page does not trigger a save. On desktop browsers this works fine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.