JQUERY form temporary function plug in share

  • 2021-01-03 20:49:28
  • OfStack

jquery. formLocalStorage is an jquery plug-in that implements universal form staging

Principle:

Monitor the changes in the form fields and use localStorage in HTML5 WebStorage to store the values of these changed form fields and load the stored values back into the form fields when the form is reloaded, thereby implementing the staging function.

Functional Features:

1. Do not use server-side storage to save server resources.

2. The code is simple, using the default configuration, only need 1 piece of code $("#your_form_id").formLocalStorage(); You can do it without having to write 1 big chunk of server-side logic.

3. Rich configuration items and default values, through which you can customize the style of the temporary storage content, the callback events after the temporary loading, storage and deletion, and the naming rules of the temporary storage. You can also use default values to reduce excessive configuration work.

Usage:

1. Use default configuration:


$("#your_form_id").formLocalStorage();

2. Use custom configuration:


$("#your_form_id").formLocalStorage({
  storage_name_perfix : 'your_storage_name_perfix', // Custom named prefixes for staging stores 
  storage_events : 'click' // Customize the staging trigger event 
});

Known problems:

1. Some dynamically written form items cannot be detected or stored temporarily.

2. The default value of storage_name_perfix is ES40en.context.URL + form_selector + "@". If there is a change in ES45en.context.URL after submission, it will fail to locate the temporary storage

Plug-in download http: / / xiazai. ofstack. com / 201602 / yuanma/jquery formLocalStorage (ofstack. com). zip


Related articles: