[FX.php List] A little JQuery/javascript help

Denis Somar dsomar at gmail.com
Mon Aug 27 09:16:30 MDT 2012


Hi Jonathan,

Put the <form> code in the email also, just to see what we're dealing with
here.

D

On Sun, Aug 26, 2012 at 7:06 PM, Jonathan Schwartz <jschwartz at exit445.com>wrote:

> Hi Folks,
>
> I've added a short script to a page to help remind the user to save their
> data before leaving a form.  I found the script in a JQuery page, but don't
> know how to make a needed modification.
>
> It works as needed if the user tries to leave the page. But, it also warns
> the user when the Submit button is clicked to save the data. That's one
> case where it should not produce a warning.
>
> Anyone know how to disarm the script in the single case of when the submit
> button is clicked, the javacsript equivalent of
>
>         if(!isset($_POST['submit']))..**.
>
> Thanks.
>
> JOnathan
>
>
>
> <script lanuage="Javascript">
> var form_clean;
>
> // serialize clean form
> $(function() {
>     form_clean = $("form").serialize();
> });
>
> // compare clean and dirty form before leaving
> window.onbeforeunload = function (e) {
>     var form_dirty = $("form").serialize();
>     if(form_clean != form_dirty) {
>         return 'There is unsaved Event data.';
>     }
> };
> </script>
> --
> Jonathan Schwartz
> Exit 445 Group
> jonathan at exit445.com
> http://www.exit445.com
> 415-370-5011
> ______________________________**_________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/**mailman/listinfo/fx.php_list<http://www.iviking.org/mailman/listinfo/fx.php_list>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20120827/3d1cc790/attachment.html


More information about the FX.php_List mailing list