Error when using <display-name-expression> with CustomSelector


#1

Enonic version: 7.0.2
OS: Linux Mint 19.1

I created a content type with two fields to test this. This is an example:

<content-type>
	<display-name>My Content</display-name>
	<display-name-expression>${tittel}</display-name-expression>
	<super-type>base:structured</super-type>
	<form>
		<input type="TextLine" name="tittel">
			<label>Tittel</label>
			<occurrences minimum="1" maximum="1"/>
		</input>
		<input type="CustomSelector" name="customField">
			<label>Custom Field</label>
			<occurrences minimum="0" maximum="0"/>
			<config>
				<service>myService</service>
			</config>
		</input>
	</form>
</content-type>

When I don’t set the value of my custom selector, the tag don’t set the display name. When I set the value, the tag works correctly.

I’m doing something wrong, or this is a bug?


#2

This is a bug we have fixed now. The fix will be released in the next bugfix version 7.0.3 of XP.


#3

FYI: Using a single input that is replicated to displayName is bad practice. Essentially, you end up with two fields of the same value in this case. This new feature coming in 7.1 might interest you: https://github.com/enonic/xp/issues/7202

As an example, if displayName is composed of two inputs, the use-case is goodl i.e. a display-name-expressions: ${firstname} ${lastname}.