0

Where can I find the code in SharePoint that determines the order of and what fields are in the Edit form? I have looked at the EditForm.aspx page and it doesn't look like this is determined there. If possible I would like to display a list generated with JSOM based off the order the fields appear in on the edit page.

Edit Could using the RenderListForm method with the REST API be a solution? It looks promising but I can't find much documentation.

14
  • 1
    I don't understand what you mean by categories. Can you elaborate? DO you mean the order of fields? That's determined by the content type of the list.
    – wjervis
    Aug 14, 2015 at 18:14
  • Yes I meant fields. So how would I access the code the content type is using to set the order of the fields? could I use a CAML query?
    – James11
    Aug 14, 2015 at 18:28
  • You just want to change the order of the column in edit form right?? Aug 14, 2015 at 18:51
  • No, I want to have another list view where the order of the columns changes if the order of the fields in the Edit column is changed.
    – James11
    Aug 14, 2015 at 18:54
  • 1
    Here is the MSDN documentation on the JS SP.ContentType object: msdn.microsoft.com/en-us/library/office/jj245579.aspx As you can see, there is a property called fieldLinks that will give you a SP.FieldLinkCollection object. You can get that by doing var fieldLinks = myContentType.get_fieldLinks();. From there you might be able to enumerate through them, or somehow get the length of the collection and use fieldLinks.itemAt(idx) to get each field link by its index. Aug 17, 2015 at 18:30

1 Answer 1

0

The order of the fields in the new/edit forms is determined by the order of the field links in the content type definition for the content type of the list.

Here is the MSDN documentation on the JS SP.ContentType object.

You can use JSOM to get the content type from the list, and it will have a property called fieldLinks that will give you a SP.FieldLinkCollection object. You can get that by doing

var fieldLinks = myContentType.get_fieldLinks();

From there you might be able to enumerate through them, or somehow get the length of the collection and use fieldLinks.itemAt(idx) to get each field link by its index.

If you need the display names of the fields, you will not be able to get them directly from the fieldLink objects, but using the ID or internal name provided by the fieldLink objects, you can get the actual SP.Field objects from the list and access their display names that way.

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.