PHPackages                             phantomwatson/form-protector - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. phantomwatson/form-protector

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

phantomwatson/form-protector
============================

Protects users from navigating away from forms before submitting them

0408JavaScript

Since Feb 4Pushed 10y ago1 watchersCompare

[ Source](https://github.com/PhantomWatson/form-protector)[ Packagist](https://packagist.org/packages/phantomwatson/form-protector)[ RSS](/packages/phantomwatson-form-protector/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

About
=====

[](#about)

This script protects a form from being navigated away from by throwing up a confirmation dialog if information has been entered but not saved.

Requirements
------------

[](#requirements)

- jQuery

Installation
------------

[](#installation)

```

```

Example
-------

[](#example)

To protect a form with id `MyFormId`:

```

    $(document).ready(function () {
        formProtector.protect('MyFormId');
    });

```

This will produce a confirmation dialog if any ``, ``, or `` has its value changed and the user navigates away by any means other than submitting the form.

If you want to manually mark a form as having been changed:

```

    $(document).ready(function () {
        formProtector.setChanged('MyFormId');
    });

```

If you want to manually mark a form as having been saved (e.g. if you have an asynchronous function that stores form data):

```

    $(document).ready(function () {
        formProtector.setSaved('MyFormId');
    });

```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/8c85adcea1d9b9f8f2d3062fa6b312aa0759b09bf8613e9fad84e21d169b3398?d=identicon)[PhantomWatson](/maintainers/PhantomWatson)

---

Top Contributors

[![PhantomWatson](https://avatars.githubusercontent.com/u/1965565?v=4)](https://github.com/PhantomWatson "PhantomWatson (4 commits)")

### Embed Badge

![Health badge](/badges/phantomwatson-form-protector/health.svg)

```
[![Health](https://phpackages.com/badges/phantomwatson-form-protector/health.svg)](https://phpackages.com/packages/phantomwatson-form-protector)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
