Calculated column in Display Form

Forums Dynamic Forms for SharePoint Calculated column in Display Form

This topic contains 4 replies, has 2 voices, and was last updated by  Paul Lynch 4 months, 1 week ago.

  • Author
    Posts
  • #19344

    Paul Lynch
    Participant

    If I add a calculated column as a field in a tab – it does not show up in my Display Form.

    I can use some JS to create a HTML Heading item and then it shows up in display form, but the formatting looks a bit odd (the rest of the fields have a question field and response field).

    Is there any reason why it by default does not show up?

  • #19348

    Alexander Bautz
    Keymaster

    I need to see a screenshot of your config and how it looks in the form.

    Alexander

  • #19351

    Paul Lynch
    Participant

    Thanks Alex. There are three dates, I just want to show these dates in a display form in a “friendly” format of dd.MMM.yyyy so want to show a calculated column instead of the original field.

    PIC 1 – Shows the configuration in form:
    1) Original Field
    2) Calculated Column (that never shows up)
    3) Is HTML in a field column I am trying to use to force it to show up!

    PIC 2 – Shows some columns – really just to confirm that the calculated column itself works great.

    PIC 3 – Shows the Display Form – notice no calculated column is shown.

    I create a HTML field workaround which shows up for one of the dates – “1.15 Start date of the OSQMV:” but not for the others?

    PIC 4 – JS of HTML field workaround – first field is ok – but if I just copy line [39] to line [40] and update the reference it doesnt work – keep getting error 80020101 wondering how to add this in, as this might be easier than trying to solve why my calculated column is not showing.

  • #19369

    Alexander Bautz
    Keymaster

    I’m not sure I understand. In DispForm you should be able to show the calculated field straight forward in the tab – no need to use script.

    Also, I haven’t actually tested out using style tags directly in the “Text or HTML” textarea – this code used here should be more plain HTML and you should use Custom CSS to keep all CSS classes. Maybe this code is the reason for the fields not showing properly?

    Alexander

  • #19373

    Paul Lynch
    Participant

    Thanks for looking Alex – still no idea why it’s not showing in display form.

    However I finally got the html/js call to bring them in with your code posted elsewhere here so I am good now thanks.

    If anyone else is looking to show 3 calculated columns in Editform. (or has issue showing in Display form see below – my internal fieldname and column names are the same btw)

    
    
    var qRes = spjs.utility.getItemByID(
    	{
    		"listName":_spPageContextInfo.pageListId,
    		"id":spjs.dffs.data.thisItemID,
    		"viewFields":["calccoldate1","calcoldate2","calccoldate3"]
    	}
    );
    
    $("span.calccoldate1").html(qRes["calccoldate1"].split(";#")[1]);
    $("span.calcoldate2").html(qRes["calcoldate2"].split(";#")[1]);
    $("span.calccoldate3").html(qRes["calccoldate3"].split(";#")[1]);  

    Then in the HTML field added to tab (repeated for each column):

    
    
    <table style="width: 100%" class="customised1">
    	<tr>
    		<td class="customisedcss2" style="font-size:10.0pt;font-family:&quot;Segoe UI Semilight&quot;,sans-serif;
    mso-fareast-font-family:&quot;Times New Roman&quot;;color:#262626;mso-ansi-language:EN-GB;
    mso-fareast-language:EN-GB; width: 87%;">text for the column label
       </td>
    <td class="customisedcss3"><span class="calcoldatecss2" /></td>

You must be logged in to reply to this topic.