-1

I've been trying to add a download function in a button in popup window, but its not working.

I've created a file view.popup.php

The code is:

<?php

require_once('include/MVC/View/views/view.popup.php');

class FP_PAYMENTSViewPopup extends ViewPopup
{
    public function __construct()
    {
        parent::__construct();
    }

    public function display()
    {

        global $app_strings;
        $id = BeanFactory::getBean('FP_PAYMENTS', $this->bean->id);
        $url = "index.php?module=FP_PAYMENTS&action=generatePaymentsPdf&record={$id}";
        echo parent::display();
        echo <<<PaymentButton
        <input type="button" class="button" style="width: 150px;" href="#" value="Payment Pdf" onmouseover='hiliteItem(this,"yes");' 
        onmouseout='unhiliteItem(this);' 
        onclick="SUGAR.ajaxUI.loadContent('{$url}')"
        " /> 
PaymentButton;
    }
}

pls any experts that can help me find what's wrong ? thanks in advance.

Pavel Smirnov
  • 4,611
  • 3
  • 18
  • 28
s0m3d3v
  • 177
  • 1
  • 13

1 Answers1

0

you have many errors while printing the payment button. you haven't managed the quotes and escape sequences.

you need to try like this

  echo "<input type='button' class='button' style='width: 150px;' href='#' value='Payment Pdf' onmouseover='hiliteItem(this,\'yes\');' 
    onmouseout='unhiliteItem(this);' 
    onclick='SUGAR.ajaxUI.loadContent(\'{$url}\')'
     />"
Syed mohamed aladeen
  • 6,507
  • 4
  • 32
  • 59
  • may be you need some more edits passing the url. and the data inside that onclick. you are passing objects – Syed mohamed aladeen Apr 10 '19 at 05:00
  • hello my friend for the suggestion but still the output it showing a blank page. there's also an error with this line onmouseover='hiliteItem(this,\'yes\');'. this is so hard so solve :/ – s0m3d3v Apr 10 '19 at 05:21