4

I want to create sections inside edit form of my list. Example how to create a section as shown in photo: enter image description here

In this example there are two sections: Informatat baze and Employement Data. How can I achieve this using C#?

4

We can use jQuery to achieve it, modify the code below and add it to a Script Editor Web Part in the edit form page.

<script src="//code.jquery.com/jquery-3.2.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
    //set section text and field name
    AddSectionBeforeField("Informatat baze","Last Name");
    AddSectionBeforeField("Employment Data","Company");
});
function AddSectionBeforeField(sectionText,fieldName){
    var $fieldTR=$(".ms-standardheader nobr:contains('"+fieldName+"')").closest("tr");
    $fieldTR.before("<tr style='background-color:gainsboro'><td colspan='2' class='ms-formbody' style='padding:0'><div style='font-size:16px;font-weight:bold;'>"+sectionText+"</div></td></tr>");
}
</script>

enter image description here

  • how to add a fiv tag within the above solution?, if i wanna manipulate with something, some modifications, its not allowing me to add div tag.because its added by tr tag – SaMolPP Apr 2 at 14:12
6

You can use SharePoint's Client Side Rendering (CSR) to customize the look and feel for SharePoint List Forms and Views. Standard mode CSR is best suited for your requirement. Please refer below link for more details.

https://www.codeproject.com/Articles/610259/SharePoint-Client-Side-Rendering-List-Forms

  • 1
    This is definitely the right way to do this. Only do it according to my way if for some reason CSR isn't capable enough. – Jussi Palo Dec 14 '17 at 14:57
4

Using SharePoint Designer, create new Edit form for the list, and set it as default. Then edit the EditForm.aspx, break the existing one table with ROW per field into two tables. Then perhaps surround the two tables with DIVs and add required HTML to show the title, as well as border.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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