SharePoint Online: How to Breakdown Metadata by Groups in List Form?

Requirement: Divide Fields into Groups in SharePoint List Forms.

How to Breakdown Metadata into Groups in List Forms?
In the New List form, We wanted to group fields into groups so that It appears:
group form fields in sharepoint online

Add a script editor web part and place this script in it. In my case, I wanted to have "Questions" grouping after "Purpose of Travel" field in the list form.
<script src="https://code.jquery.com/jquery-3.5.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
    //set section text and field name
    AddSectionAfterField("Questions","Purpose of Travel");
});

function AddSectionAfterField(sectionText,fieldName){
    var $fieldTR=$(".ms-standardheader nobr:contains('"+fieldName+"')").closest("tr");
    $fieldTR.after("<tr style='background-color:white'><td colspan='2' class='ms-formbody' style='padding:0; color: #000;'><div style='font-size: 20px;margin-top: 10px;margin-bottom: 10px;'>"+sectionText+"</div><hr style='max-width: 550px;  margin: 0px; padding-bottom:15px'></td></tr>");
}

</script>
This approach works only on Classic experience.

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.