Page 1 of 1

How to disable Print Preview?

Posted: 2015-12-31 02:08
by globaldrip8
Help...im using appgini 5.50,and try to hide Print Preview in Detail view hooks

i tried using this trick on this link http://forums.appgini.com/phpbb/viewtopic.php?t=805

Code: Select all

function TABLENAME_dv($selectedID, $memberInfo, &$html, &$args){
    // ****************************************************************
    // Remove "PRINT PREVIEW" button from the detail view editing form 
    // ****************************************************************
    // HTML for detail view PRINT PREVIEW button as generated by AppGini: 
    //      <button tabindex="2" type="submit" id="dvprint" name="dvprint_x" value="1" 
    //       onclick="$$('form')[0].writeAttribute('novalidate', 'novalidate'); document.myform.reset(); 
    //        return true;"><img src="print-preview.gif" /> __BUTTON LABEL TEXT__</button>
    //
    // Get the global variable for language text
    global $Translation;

    // Get the text of the button label
    $buttLabel = $Translation['Print Preview'];

    // Delete it!
    $html = str_replace("<button tabindex=\"2\" type=\"submit\" id=\"dvprint\" name=\"dvprint_x\" value=\"1\" onclick=\"$$('form')[0].writeAttribute('novalidate', 'novalidate'); document.myform.reset(); return true;\"><img src=\"print-preview.gif\" /> $buttLabel</button>","",$html);
}
but still not work

Re: How to disable Print Preview?

Posted: 2016-01-03 15:50
by a.gneady
The code for the print preview button of the detail view might have been slightly changed so using str_replace won't match it .. using regex (regular expressions) is better. Try this:

Code: Select all

$html = preg_replace('/<button.*?dvprint_x.*?<\/button>/i', '', $html);

Re: How to disable Print Preview?

Posted: 2016-01-04 03:28
by globaldrip8
Thanks Ahmad,its working well :)

Re: How to disable Print Preview?

Posted: 2024-07-10 17:11
by rpierce
Beautiful! Thank you, Ahmad!!