Displayname is not filled


#1

Enonic version: 7.0.2
OS: Linux Mint 19.2

I found a bug when the tag display-name-expression is added in a content type that have one or more variables with the character - in the name. For example:

This works:

<content-type>
  <display-name>My Content Type</display-name>
  <display-name-expression>${tittel}</display-name-expression>
  <description>My Content Type</description>
  <super-type>base:structured</super-type>
  <form>
    <input type="TextLine" name="tittel">
      <label>Tittel</label>
      <occurrences minimum="1" maximum="1"/>
    </input>
    <input type="TextLine" name="tittel2">
      <label>Tittel</label>
      <occurrences minimum="1" maximum="1"/>
    </input>
  </form>
</content-type>

And this not works:

<content-type>
  <display-name>My Content Type</display-name>
  <display-name-expression>${tittel}</display-name-expression>
  <description>My Content Type</description>
  <super-type>base:structured</super-type>
  <form>
    <input type="TextLine" name="tittel">
      <label>Tittel</label>
      <occurrences minimum="1" maximum="1"/>
    </input>
    <input type="TextLine" name="tittel-2">
      <label>Tittel</label>
      <occurrences minimum="1" maximum="1"/>
    </input>
  </form>
</content-type>

#2

Just reproduced this myself.
When reporting bugs please tell what the actuall bug is, not just the senario under it.

The display name field in not filled in when other input fields have a - (dash) in them.

I would strongly recommend to not have - (dash) in input names.
Since the xml name attributes is used when accessing them in JS.

Eg. data[“title-2”] vs data.title2

I will report this bug further to the development team.
Thank you for finding and reporting the bug. :smile:


#3

Enonic version: 7.2.0
Content Studio version: 2.3.0

I found a similar bug in the new version of Content Studio (2.3.0). But now, the bug is related with the field-set tag:


This works:

<content-type>
  <display-name>My Content</display-name>
  <display-name-expression>${tittel}</display-name-expression>
  <description>My Content Type</description>
  <super-type>base:structured</super-type>
  <form>
    <input type="TextLine" name="tittel">
      <label>Tittel</label>
    </input>
  </form>
</content-type>

And this not works:

<content-type>
  <display-name>My Content</display-name>
  <display-name-expression>${tittel}</display-name-expression>
  <description>My Content Type</description>
  <super-type>base:structured</super-type>
  <form>
    <field-set>
      <label>My field-set</label>
      <items>
        <input type="TextLine" name="tittel">
          <label>Tittel</label>
        </input>
      </items>
    </field-set>
  </form>
</content-type>


#4

Thank you for reporting this. Here’s the issue we registered: https://github.com/enonic/app-contentstudio/issues/1406


#5

Hi!
I have an issue when a displayName is not filled via display-name-expression in XP 7.2.0 and CS 2.3.1. The expressions might have one or two attributes in it.
Here is a js error:

bundle.js:2 Cannot evaluate script ["use strict";var relatedLocale = ''; var newsTitle = ''; var newsType = ''; var newsImage = ''; var newsByline = ''; var newsBylineString = ''; var newsIngressShort = ''; var newsIngress = ''; var newsContact = ''; var relatedPublications = ''; var relatedProjects = ''; var relatedNews = ''; var tags = ''; newsTitle = 'test'; newsType = 'FEATURED'; newsImage = '2e105239-3b7e-4c7a-a4fa-ef3403843c17'; newsIngress = 'test'; `${NEWS_TITLE}`.trim().replace(/\s+/g, ' ')]. ReferenceError: NEWS_TITLE is not defined
    at eval (eval at DisplayNameResolver.safeEval (bundle.js:2), <anonymous>:1:426)
    at DisplayNameResolver.safeEval (bundle.js:2)
    at DisplayNameResolver.execute (bundle.js:2)
    at HTMLDivElement.<anonymous> (bundle.js:2)

Here is the simple example of content type. Please, note display name is filled as TextArea in this case, but we have also a content type, that has TextLine in expression with the same error. Please, let me know if you would like me to post more examples or any other info. Thanks!

<?xml version="1.0" encoding="UTF-8"?>
<content-type>
  <display-name>News</display-name>
  <display-name-expression>${NEWS_TITLE}</display-name-expression>
  <super-type>base:structured</super-type>
  <form>
    <input name="RELATED_LOCALE" type="ContentSelector">
      <label>News page in other languages</label>
      <occurrences minimum="0" maximum="1"/>
      <config>
        <relationshipType>system:reference</relationshipType>
        <allowPath>*</allowPath>
        <allowContentType>news</allowContentType>
      </config>
    </input>
    <input type="TextArea" name="NEWS_TITLE">
      <label>Title</label>
      <occurrences minimum="1" maximum="1"/>
    </input>
    <input type="ComboBox" name="NEWS_TYPE">
      <label>News Type</label>
      <occurrences minimum="1" maximum="1"/>
      <config>
        <option value="FEATURED">Featured</option>
        <option value="REGULAR">Regular</option>
        <option value="MINOR">Minor</option>
      </config>
    </input>
    <input type="ImageSelector" name="NEWS_IMAGE">
      <label>Main image</label>
      <occurrences minimum="1" maximum="1"/>
    </input>
    <input type="HTMLArea" name="NEWS_IMAGE_CAPTION">
      <label>Image caption</label>
      <occurrences minimum="0" maximum="1"/>
    </input>
    <input name="NEWS_BYLINE" type="ContentSelector">
      <label>News byline content selector</label>
      <occurrences minimum="0" maximum="1"/>
      <config>
        <relationshipType>system:reference</relationshipType>
        <allowPath>*</allowPath>
        <allowContentType>employee</allowContentType>
      </config>
    </input>
    <input name="NEWS_BYLINE_STRING" type="TextLine">
      <label>News byline string</label>
    </input>
    <input type="TextArea" name="NEWS_INGRESS_SHORT">
      <label>Forsideingress</label>
      <occurrences minimum="0" maximum="1"/>
    </input>
    <input type="TextArea" name="NEWS_INGRESS">
      <label>Ingress</label>
      <occurrences minimum="1" maximum="1"/>
    </input>
    <input name="NEWS_CONTACT" type="ContentSelector">
      <label>Contact</label>
      <occurrences minimum="0" maximum="0"/>
      <config>
        <relationshipType>system:reference</relationshipType>
        <allowPath>*</allowPath>
        <allowContentType>employee</allowContentType>
      </config>
    </input>
    <input name="RELATED_PUBLICATIONS" type="ContentSelector">
      <label>Related publications</label>
      <occurrences minimum="0" maximum="0"/>
      <config>
        <relationshipType>system:reference</relationshipType>
        <allowPath>*</allowPath>
        <allowContentType>publication</allowContentType>
      </config>
    </input>
    <input name="RELATED_PROJECTS" type="ContentSelector">
      <label>Related projects</label>
      <occurrences minimum="0" maximum="0"/>
      <config>
        <relationshipType>system:reference</relationshipType>
        <allowPath>*</allowPath>
        <allowContentType>project</allowContentType>
      </config>
    </input>
    <input name="RELATED_NEWS" type="ContentSelector">
      <label>Related news</label>
      <occurrences minimum="0" maximum="0"/>
      <config>
        <relationshipType>system:reference</relationshipType>
        <allowPath>*</allowPath>
        <allowContentType>news</allowContentType>
      </config>
    </input>
    <mixin name="tags"/>
  </form>
</content-type>

#7

Thanks for reporting this. We have the fix ready, will be released with Content Studio 2.3.2 during this week.


#8

The fix is available in Content Studio 2.3.2


#9

Thanks. This error is gone after an update. :slight_smile:


#10