Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two instances of printer popup loading #98

Closed
drkrtj opened this issue Aug 19, 2018 · 5 comments
Closed

Two instances of printer popup loading #98

drkrtj opened this issue Aug 19, 2018 · 5 comments

Comments

@drkrtj
Copy link

drkrtj commented Aug 19, 2018

Expected behaviour

Observed behaviour

Steps to reproduce the issue

Simplified demo link reproducing the issue

jQuery, jQuery.print version

Browser and operating system

@drkrtj
Copy link
Author

drkrtj commented Aug 19, 2018

Hello,
I am sure I am doing something wrong. I am getting two instances of the printer popup showing which triggers the, "Prevent this page from creating additional dialogs". How do I correct this issue? Here is my button and script setup.
Thanks

Printout Form

<script> jQuery(function($) { 'use strict'; $(".payment_processing_check_by_mail").find('#print_giftcert_check_mo_mailform').on('click', function() { //Print with custom options $(".giftcert_checkmailform").print( { globalStyles: true, mediaPrint: true, stylesheet: null, noPrintSelector: ".no-print", iframe: true, append: null, prepend: null, manuallyCopyFormValues: true, deferred: $.Deferred(), timeout: 750, title: null, doctype: '' }); }); }); </script>

@drkrtj
Copy link
Author

drkrtj commented Aug 19, 2018

Printout Form

@drkrtj
Copy link
Author

drkrtj commented Aug 19, 2018

<button class="giftcert_check_mo_mailprint_button" id="print_giftcert_check_mo_mailform" onclick="jQuery.print()">Printout Form</button>

`<script>
jQuery(function($) {
'use strict';

        $(".payment_processing_check_by_mail").find('#print_giftcert_check_mo_mailform').on('click', function() {
            //Print with custom options
			
            $(".giftcert_checkmailform").print( {
				globalStyles: true,
				mediaPrint: true,
				stylesheet: null,
				noPrintSelector: ".no-print",
				iframe: true,
				append: null,
				prepend: null,
				manuallyCopyFormValues: true,
				deferred: $.Deferred(),
				timeout: 750,
				title: null,
				doctype: '<!doctype html>'
			});
        });
	});

</script>`

@CitizenOfRome
Copy link

You are calling it twice, once in the HTML onclick and then the script tag

@drkrtj
Copy link
Author

drkrtj commented Aug 19, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants