Page 1 of 2

Add edit button on display form

Posted: 05 Apr 2016
by mcgaafar
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,

Re: Add edit button on display form

Posted: 06 Apr 2016
by rostislav
Hi,

Add the toolbar and then add the following JS:

Code: Select all

$('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');

Re: Add edit button on display form

Posted: 06 Apr 2016
by mcgaafar
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.

Re: Add edit button on display form

Posted: 06 Apr 2016
by rostislav
1. Click 'Buttons' in FD
2. Add a button beside 'Save'
3. Add onclick code to it:

Code: Select all

 window.location.href = 'https://example.com/Lists/b/fd_Item_EditForm.aspx?ID=' + GetUrlKeyValue('ID');
Make sure the URL is correct.

Re: Add edit button on display form

Posted: 06 Apr 2016
by mcgaafar
Thanks a lot, but what if somebody changed the list name?

Re: Add edit button on display form

Posted: 06 Apr 2016
by rostislav
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.

Re: Add edit button on display form

Posted: 06 Apr 2016
by mcgaafar
Alright, thanks a lot for your help.

Re: Add edit button on display form

Posted: 22 Jun 2017
by TKay
Hi Guys,

Here is my list: https://sharepoint domain name.com/sites/Site1/SubSite1/Lists/List1/AllItems.aspx
when I modify the following : window.location.href = 'https://ex a mple.com/Lists/b/fd_Item_EditForm.aspx?ID=' + GetUrlKeyValue('ID');
to
window.location.href = 'https://sharepoint domain name.com/sites/Site1/SubSite1/Lists/List1/fd_Item_EditForm.aspx?ID=' + GetUrlKeyValue('ID');

and then add it to onClick in FD, I get 404 error.

What am I doing wrong? Do I need to provide the ID of the list too?

Thanks

Re: Add edit button on display form

Posted: 22 Jun 2017
by Dmitry Kozlov
Hi,
Make sure that 'fd_Item_EditForm.aspx' form exists: just open the edit form of the List1 from a view and compare its URL with the URL of 404 page.

Re: Add edit button on display form

Posted: 22 Jun 2017
by TKay
will this work when forms are open in a dialog box?

Thanks