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