Skip to content

Plugin for detecting easily changed formulares. Example of use could be a save button which is only enabled if changes are done in form fields.

License

Notifications You must be signed in to change notification settings

prodigy7/jquery-formChangeDetect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

jQuery Form change detect Plugin

Plugin for detecting easily changed formulares. Example of use could be a save button which is only enabled if changes are done in form fields.

Quick usage example:

$(document).ready(function() {
 $('form').formChangeDetect({
   debug: true,
   onElementChange: function(elem, state) {
     $('input[name="lastChanged"]').val($(elem).attr('name'));
 
     var elementsChanged = '';
     $('form').formChangeDetect().getChanged().each(function() {
       elementsChanged += '|' + $(this).attr('name');
     });
   
     $('textarea[name="elementsChanged"]').val(elementsChanged);
   },
   onStatusChange: function(form, state) {
     $('input[name="formStatus"]').val(state);
   },
 });
});

Options

Show some debug output. Possible values: true | false

debug: true

Triggers function if element status changed from changed to unchanged or unchanged to changed.

onElementChange: function() { }

Triggers function if form status changed from changed to unchanged or unchanged to changed.

onStatusChange: function() { }

Functions

Initiate plugin:

$('form').formChangeDetect();

Get boolean state about change state:

$('form').formChangeDetect().hasChanged();

Get object array with changed elements:

$('form').formChangeDetect().getChanged();

About

Plugin for detecting easily changed formulares. Example of use could be a save button which is only enabled if changes are done in form fields.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published