3

I have a SharePoint 2010 list and I customize the form using InfoPath, now I add a content web part to edit form to display a custom button in the form ribbon like in this form from another list enter image description here

but using the same code the icon don't appear

enter image description here

here the code that I'm using:

<script src="/Documents/jQuery/jquery-1.8.2.min.js"type="text/javascript"></script>
  <script src="/Documents/jQuery/jquery.SPServices-0.7.2.js" type="text/javascript"></script>
   <style type="text/css" media="print">
   @page  {size: auto; }</style>
  <script language="javascript" type="text/javascript">

 $(document).ready(function(){

 $('​<img width="77" height="79" id="PrimeiraAdenda" title="Print" alt="Print.png" Location="CommandUI.Ribbon.DisplayForm" src="link to image"  style=" cursor:hand; margin: 5px; width: 52px; height: 52px;"/>').insertAfter   ($('[role=tabpanel] li').last());


 $('#PrintAdenda').click(function(){
   stuff
  })

 });


</script>​ ​​​​​​​​​​​
2
  • Do you wish to add a submit button on your custom InfoPath form? Commented Sep 30, 2016 at 10:25
  • No, the rest of the code I hide. that button (The printer), uses SPServices to generate a pdf template from the selected item Commented Sep 30, 2016 at 10:27

1 Answer 1

1

No need for code, just use SharePoint Designer to add a Custom Action:

  • connect to the site using SharePoint Designer
  • go to 'Lists and Libraries' and open the list by clicking on the name
  • go to 'Custom Action' in the ribbon and choose 'View Ribbon'
  • type a name
  • choose 'Navigate to URL' and fill in the correct URL to the page (use {selecteditemid} in the query string for the id of the selected item
  • specify the images
3
  • I can´t use SharePoint designer :( Commented Sep 30, 2016 at 10:43
  • you can also use Javascript to add a custom action button to the Ribbon, see the following question on StackOverflow: sharepoint.stackexchange.com/questions/101982/… Commented Sep 30, 2016 at 11:01
  • If you edit the form with infopath you won't be able to add custom actions... I have just lost three buttons. :((
    – jpfreire
    Commented Apr 2, 2019 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.