• Resolved joncon62

    (@joncon62)


    If a user edits a post from the dashboard but exits without saving, how can I display a warning there are unsaved changes? At the moment it allows the exit and the edits are lost.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support MM Aurangajeb

    (@aurangajeb)

    Hello @joncon62

    You can enable the “Post Draft” mode from the particular forms’ settings- https://prnt.sc/1th6pc4. And a warning before leaving the page is currently unavailable with the plugin. However, I will keep this suggestion as an enhancement request in my notebook.

    Kind Regards.

    Thread Starter joncon62

    (@joncon62)

    Thanks, in the meantime I’m using the jQuery plugin jquery.are-you-sure but I don’t think it’s supported anymore. Seems to work though.

    Plugin Support MM Aurangajeb

    (@aurangajeb)

    Hi,

    Do you mean an additional WordPress plugin that supports jquery.are-you-sure? or do you integrate the jquery library jquery.are-you-sure with the WPUF in your site?

    You can share your workaround here which might help others.
    Thanks.

    Thread Starter joncon62

    (@joncon62)

    I integrated it into my site. For those interested, get the plugin from Here then put the following code into functions.php of your child theme or use the code snippets plugin.

    // Check if there are unsaved changes and show warning
    add_action( 'wpuf_before_form_render', 'wpuf_unsaved_changes' );
    function wpuf_unsaved_changes( $form_id ) {
    	?>
    		<script type="text/javascript" src= "path/to/js/jquery.are-you-sure.js"></script>
    		<script>
    		jQuery( document ).ready(function($) {
    			$('form').areYouSure();
    		});
    		</script>
    	<?php
    }
    

    Make sure you use the correct

    path/to

    in the code above. There may be a more elegant solution but this works for me.

    • This reply was modified 10 months, 3 weeks ago by Yui. Reason: formatting
    Plugin Support MM Aurangajeb

    (@aurangajeb)

    Hi,
    Thanks for sharing the workaround in detail @joncon62 !

    I hope this will help others as well 🙂
    Cheers!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Exit without save warning’ is closed to new replies.