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

Dotnet Guru Archives