TOPIC:

Warn on exit if form is not saved 2 weeks 2 days ago #248035

  • Topic Author
  • deeplogica
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 44
  • Thanks: 0
Hi

How can I warn the user if they decide to navigate to another page without first submitting the form?

Note - the Allow edit is OFF and has to be off because of our logic with users being able to fill in multiple forms of the same type.

thanks

Please Log in or Create an account to join the conversation.

Warn on exit if form is not saved 2 weeks 1 day ago #248053

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10063
  • Karma: 167
  • Thanks: 799
Hi,

sure! Please add this in form => advanced => more options => form pieces => before form => custom:
echo '

<script>
JQuery(window).on("beforeunload", function() {
    JQuery(this).get(0).disabled = false;
    return "Are you sure? You didn\'t finish the form!";
});
		
JQuery(document).ready(function() {
    JQuery(".bfSubmitButton").on("click", function(e) {
        JQuery(window).off("beforeunload");
            return true;
        });
});
</script>

';

Example form attached (you might want to open the form in a separate window for testing rather than the preview in backend).

Regards,
Markus

File Attachment:

File Name: warnbeforelave.zip
File Size:5 KB
Attachments:

Please Log in or Create an account to join the conversation.

Last edit: Post by TheMuffinMan.

Warn on exit if form is not saved 2 weeks 28 minutes ago #248140

  • Topic Author
  • deeplogica
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 44
  • Thanks: 0
Hi
Thanks for that.. however when I use this code, it doesnt display the text I put in. just displays
'LEAVE SITE'
Changes that you made may not be saved.

thanks

Please Log in or Create an account to join the conversation.

Warn on exit if form is not saved 1 week 4 days ago #248185

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10063
  • Karma: 167
  • Thanks: 799
Hi,

I think you cannot add custom text anymore. It has been removed in recent versions of browsers like Chrome because it has been used to trick users by providing false information.

Regards,
Markus

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.039 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!