Add edit button on display form

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
mcgaafar
Posts: 44
Joined: Sun Jan 17, 2016

05 Apr 2016

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,

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

06 Apr 2016

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

mcgaafar
Posts: 44
Joined: Sun Jan 17, 2016

06 Apr 2016

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.

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

06 Apr 2016

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.

mcgaafar
Posts: 44
Joined: Sun Jan 17, 2016

06 Apr 2016

Thanks a lot, but what if somebody changed the list name?

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

06 Apr 2016

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
Posts: 44
Joined: Sun Jan 17, 2016

06 Apr 2016

Alright, thanks a lot for your help.

TKay
Posts: 11
Joined: Mon Jun 19, 2017

22 Jun 2017

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

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

22 Jun 2017

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.

TKay
Posts: 11
Joined: Mon Jun 19, 2017

22 Jun 2017

will this work when forms are open in a dialog box?

Thanks

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests