Wednesday 13 March 2013

Dirty Forms

Prevent users from losing data when editing forms:


Dirty Forms is a flexible jQuery plugin to help prevent users from losing data when editing forms.Dirty Forms will alert a user when they attempt to leave a page without submitting a form they have entered data into.
Prerequisites

Must have jQuery Library version 1.4.2 or higher.
easy to use.

<script type="text/javascript" src="http://mal.co.nz/wp-content/themes/boldy/js/jquery-1.4.2.min.js"></script>

<script type="text/javascript" src="jquery.dirtyforms.js"></script>
<script type="text/javascript">

$(document).ready(function(){

      $('#testform').dirtyForms();
 
 $('#dirtycheck').click(function(){
 if($.DirtyForms.isDirty()){
 alert("Your form is so dirty...");
 }else{
 alert("Your form is a saint, nothing dirty about her");
 }
    });

});
</script>

<form id="testform">
<input type="text" value="Change me to make me dirty" />
<input id="dirtycheck" type="button" value="Am I dirty?" />
</form>

Public Methods

$.DirtyForms.isDirty() will return true if any watched elements are considered dirty. 
Syntax: if($.DirtyForms.isDirty())


Continue Reading →

Topics

ADFS (1) ADO .Net (1) Ajax (1) Angular (43) Angular Js (15) ASP .Net (14) Authentication (4) Azure (3) Breeze.js (1) C# (47) CD (1) CI (2) CloudComputing (2) Coding (7) CQRS (1) CSS (2) Design_Pattern (6) DevOps (4) DI (3) Dotnet (8) DotnetCore (16) Entity Framework (2) ExpressJS (4) Html (4) IIS (1) Javascript (17) Jquery (8) Lamda (3) Linq (11) microservice (3) Mongodb (1) MVC (46) NodeJS (8) React (11) SDLC (1) Sql Server (32) SSIS (3) SSO (1) TypeScript (1) UI (1) UnitTest (1) WCF (14) Web Api (15) Web Service (1) XMl (1)

Dotnet Guru Archives