Add edit button on display form

rss

Posted by mcgaafar - Apr 5 ’16 at 11:40

Hi,

I disabled the ribbon control on my display form, and i don't want to add the toolbar as well, i only need to place an "Edit" button so that the user can edit the item. How can i do that?

Thanks,

  • rostislav
    rostislav
    Moderator
    Member for: 4 years 3 months 12 days
    #1 by rostislav Apr 6 ’16 at 05:52

    Hi,

    Add the toolbar and then add the following JS:

    $('td.ms-toolbar > span > table > tbody > tr >  td.ms-toolbar:not(:eq(0))').css('display', 'none');
    $('td.ms-toolbar > span > table > tbody > tr >  td.ms-separator').css('display', 'none');
     
  • mcgaafar
    Member
    Member for: 3 years 6 months 30 days
    #2 by mcgaafar Apr 6 ’16 at 06:14

    [#1]: I don't want to use the edit link of the toolbar, i want to place an "Edit" button beside the "Close" button on the display form.

    Appreciate your help,

    Thanks.

  • rostislav
    rostislav
    Moderator
    Member for: 4 years 3 months 12 days
    #3 by rostislav Apr 6 ’16 at 07:35

    [#2]:

    1. Click 'Buttons' in FD

    2. Add a button beside 'Save'

    3. Add onclick code to it:

     window.location.href = 'https://example.com/Lists/b/fd_Item_EditForm.aspx?ID=' + GetUrlKeyValue('ID');

    Make sure the URL is correct.

  • mcgaafar
    Member
    Member for: 3 years 6 months 30 days
    #4 by mcgaafar Apr 6 ’16 at 07:42

    [#3]: Thanks a lot, but what if somebody changed the list name?

  • rostislav
    rostislav
    Moderator
    Member for: 4 years 3 months 12 days
    #5 by rostislav Apr 6 ’16 at 07:47

    [#4]:

    The URL contains the factual name of the list that is only ever set once - when the list is created. You can only rename the display name of a list.

  • mcgaafar
    Member
    Member for: 3 years 6 months 30 days
    #6 by mcgaafar Apr 6 ’16 at 07:50

    Alright, thanks a lot for your help.

Displaying 1 to 6 of 6 messages