Print on new Blank Page

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
lzonca
Posts: 16
Joined: 2019-03-11 14:48

Print on new Blank Page

Post by lzonca » 2020-06-19 16:00

I need help,
how can I make sure that by pressing the "STAMPA" button the page is opened in a new blank page ??? the "STAMPA" page automatically creates a pdf page by script FPDF, but opens above the DV and therefore I am forced to go back with the browser's back button.
It would be more convenient to open new pages and then close it with the X.
ThankYou




$j(function(){
<?php if($selectedID){ ?>
$j('#Servizi_dv_action_buttons .btn-toolbar').append(
'<div class="btn-group-vertical btn-group-lg" style="width: 100%;">' +
'<button type="button" class="btn btn-default btn-lg" onclick="print_servizio()">' +
'<i class="glyphicon glyphicon-print"></i>STAMPA</button>' +
'</div>'
);
<?php } ?>
});

function print_servizio(){
var selectedID = '<?php echo urlencode($selectedID); ?>';
window.location = 'Servizi_stampa.php?id_servizio=' + selectedID;
}
</script>
Attachments
print.jpg
print.jpg (51.82 KiB) Viewed 45399 times

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1638
Joined: 2018-04-01 10:12

Re: Print on new Blank Page

Post by pbottcher » 2020-06-20 07:25

Hi,

try instead

window.location = 'Servizi_stampa.php?id_servizio=' + selectedID;

Code: Select all

var url='Servizi_stampa.php?id_servizio=' + selectedID;
$('<a href="'+url+'" target="_blank"></a>')[0].click();
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

lzonca
Posts: 16
Joined: 2019-03-11 14:48

Re: Print on new Blank Page

Post by lzonca » 2020-06-27 17:09

hi, i change my code with this, but when i press the button no action run

Code: Select all

function print_servizio(){
var selectedID = '<?php echo urlencode($selectedID); ?>';
var url='Servizi_stampa.php?id_servizio=' + selectedID;
$('<a href="'+url+'" target="_blank"></a>')[0].click();
			}

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1638
Joined: 2018-04-01 10:12

Re: Print on new Blank Page

Post by pbottcher » 2020-06-27 19:16

Hi,

there is a missing j in my code.

Pls. try

Code: Select all

function print_servizio(){
var selectedID = '<?php echo urlencode($selectedID); ?>';
var url='Servizi_stampa.php?id_servizio=' + selectedID;
$j('<a href="'+url+'" target="_blank"></a>')[0].click();
}
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

lzonca
Posts: 16
Joined: 2019-03-11 14:48

Re: Print on new Blank Page

Post by lzonca » 2020-07-06 12:41

Thanks a lot, it works great

Post Reply