Support

Account

Home Forums Backend Issues (wp-admin) Unwanted "Confirm Navigation" dialog on WordPress when navigating away from an A

Solving

Unwanted "Confirm Navigation" dialog on WordPress when navigating away from an A

  • In WordPress I have a custom select field on which I initialize fontIconPicker to convert it into an icon select field. The problem is that WordPress thinks it for a form change and every time on navigating away from that page, a “Confirm Navigation” dialog pops up.

    
    if( typeof acf.add_action !== 'undefined' ) {
       acf.add_action('ready append', function( $el ){
          acf.get_fields({ type : 'fonticonpicker'}, $el).each(function(){
             $(this).find('.acf-iconpicker').each(function(){
             // The check is made so repeaters wont trigger the script before time
                if ( !$(this).parents('.row-clone').length ){
                   // Let's iconpick!!!
                   $(this).fontIconPicker({
                      iconsPerPage: 33
                   });
                }
             });
          });
       });
    }
    

    How can this dialog be bypassed?

  • Hi eXalted,

    Im experiencing the exact same problem. Did you happen to find a solution? I realise that this is probably not an ACF issue, but a fonticonpicker issue, as disabling the fonticonpicker scripts solves this – but leaves you with a simple select instead. But I can’t figure out why it considers it a form change. The selected <option> value doesn’t seem to change. If you found a solution I would love to know how?

    Cheers.

  • I followed this up with the developer of fonticonpicker on github, see here:

    https://github.com/micc83/fontIconPicker/issues/26#issuecomment-165117138

  • Thanks for that link!

    I followed a solution from Elliot and it worked. Here is the email from him:

    It may be possible that the fontIcon JS is triggering a ‘change’ on the input. I don’t understand why, but that would explain why the prompt is showing up.

    An easy fix is to reset the ACF unload js with the following line:

    acf.unload.off();

    You could run this after initialization, and it will rest the alert ‘changed’ variable

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Unwanted "Confirm Navigation" dialog on WordPress when navigating away from an A’ is closed to new replies.