1

I have a task list and in my task list I am using custom a EditForm.aspx page instead of default a EditForm.aspx.

I want to add a ribbon button in my custom form. Actually we are overriding the default EditForm.aspx and in that form I am adding some custom code.

I check my list in SharePoint Designer and the custom ribbon shows there but it is not added to the ribbon of EditForm.

Here is how I implement a button in the ribbon in my code:

<CustomAction
  Id="SaveAndContinueForm.EditFormToolbar"
  RegistrationId="150"
  RegistrationType="List"
  Location="CommandUI.Ribbon.ListView"
  Sequence="5"
  Title="Save and New">
<!--<UrlAction Url="/crm/Lists/listname/EditForm.aspx"/>-->
<CommandUIExtension>
  <CommandUIDefinitions>
    <CommandUIDefinition Location="Ribbon.ListForm.Edit.Commit.Controls._children">
      <Button
      Id="SaveAndContinueForm.Toolbar.Ribbon.Button"
      Alt="Save and New"
      Sequence="1"
      Command="Ribbon.EditForm.Custom.Button.SaveAndContinue"
      Image32by32="~site/_layouts/1033/images/SaveAs32.png"
      LabelText="Save and Continue"
      TemplateAlias="o1" />
    </CommandUIDefinition>
  </CommandUIDefinitions>

  <CommandUIHandlers>
    <CommandUIHandler
    Command="Ribbon.EditForm.Custom.Button.SaveAndContinue"
    CommandAction="javascript:javascriptMethodCall('{ListId}','{ItemId}','{SiteUrl}');"
/>
  </CommandUIHandlers>
</CommandUIExtension>

Can anyone please tell me what I am doing wrong?

1
  • try to change the Location Value in the CustomAction tag to "CommandUI.Ribbon.DisplayForm". In the Image32by32 attribute of the Button tag you dont need "~site", i think
    – ReTech
    Mar 18, 2016 at 11:21

2 Answers 2

1

I think you are missing Maxsize element, try by adding the following code after section

 <CommandUIDefinition Location="Ribbon.ListForm.Edit.Scaling._children">
      <MaxSize
        Id="Ribbon.ListForm.Edit.MaxSize"
        Sequence="15"
        GroupId="Ribbon.ListForm.Edit.Groups.CustomGroup"
        Size="NewGroupInExistingTabOneLarge" />          
    </CommandUIDefinition>
    <CommandUIDefinition Location="Ribbon.ListForm.Edit.Groups._children">
      <Group Id="Ribbon.ListForm.Edit.Groups.CustomGroup"
        Sequence="100" Title="Actions"
        Description="Custom Action Group"
        Template="Ribbon.Templates.CustomTemplate">
        <Controls Id="Ribbon.ListForm.Edit.Groups.CustomGroup.Controls">
          <Button
            Id="Ribbon.ListForm.Edit.Groups.CustomGroup.Controls.Button"
            Alt="Select Image"
            Sequence="1"
            Image32by32="/_layouts/images/PicturePicker/image_32.png"
            Command="SelectImageCommand"
            LabelText="Select Image"
            TemplateAlias="Button1"
            CommandType="General"/>
        </Controls>
      </Group>
    </CommandUIDefinition>
1
  • Thanks @Anuja for your reply, but doesn't works for me as i am using default ribbon not custom one. What i did is just placing custom webpart in the main zone of EditForm.aspx. Can you suggest any other solution?
    – Rahul Jain
    Jun 16, 2014 at 11:32
1

update you location attribute with

Location="CommandUI.Ribbon.EditForm"

and add rights attribute in custom action

Rights="EditListItems"

Your Answer

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

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