Quantcast
Channel: SharePoint 2010 - General Discussions and Questions forum
Viewing all articles
Browse latest Browse all 17574

Custom Print Button on Infopath List EditForm not showing

$
0
0
 

  Here is the code i created to add a print button on an Infopath List edit form.

When I chaneg the location to the display form the button show fine, however when i try and put it on the

edit form it does not show. Can anyone give me a reason why it doesn't show?<CustomAction Id="Ribbon.InfoPath.Actions.AddCustomButton"
     Location="CommandUI.Ribbon.EditForm"
           Title="PrintButton"
           xmlns="http://schemas.microsoft.com/sharepoint/">


    <CommandUIExtension xmlns="http://schemas.microsoft.com/sharepoint/">
      <CommandUIDefinitions>
        <CommandUIDefinition Location="Ribbon.ListForm.Edit.Actions.Controls._Children">
          <Button Id="Ribbon.ListForm.Edit.Actions.Controls.Print"
                  Command="Print"
                  LabelText="Print Item"
                  Sequence="16"
                  TemplateAlias="o2"
                  Image16by16="/_layouts/images/printer.png"
                  Image32by32="/_layouts/images/printer.png"/>
        </CommandUIDefinition>
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler
           Command="Print"
               CommandAction="javascript:
                          var patt = /.+_FormControl.+__ViewContainer/gi;
                          var alldivs = document.getElementsByTagName('div');
                          var printpageHTML = '';
                          for(var i=0; i&lt;alldivs.length; i++){
                            if(patt.test(alldivs[i].id)){
                              printpageHTML = '&lt;HTML&gt;&lt;HEAD&gt;\n' +
                                              document.getElementsByTagName('HEAD')[0].innerHTML +
                                              '&lt;/HEAD&gt;\n&lt;BODY&gt;\n' +
                                              alldivs[i].innerHTML.replace('inline-block','block') +
                                              '\n&lt;/BODY&gt;&lt;/HTML&gt;';
                              break;
                            }
                          }
                          var printWindow = window.open('','printWindow');
                          printWindow.document.open();
                          printWindow.document.write(printpageHTML);
                          printWindow.document.close();
                          printWindow.print();
                          printWindow.close();
                          SP.UI.Notify.addNotification('Exiting!');

                         
                           ">

        </CommandUIHandler>
      </CommandUIHandlers>
    </CommandUIExtension>
  </CustomAction>
 
    

 




Viewing all articles
Browse latest Browse all 17574

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>