Search code examples
xsdtridiontridion-2011

Adding multiple default values for multivalued Schema field in SDL Tridion 2011 SP1


I have a multivalue single-line text field defined in my SDL Tridion 2011 Web Schema. The field is mandatory (minOccurs=1) and can repeat twice (maxOccurs=2). I have managed to set a default value for the first instance of the field, is it possible to set a default for the second instance?

I tried adding it like this.

<xsd:element name="name" minOccurs="1" maxOccurs="2" type="xsd:normalizedString">
    <xsd:annotation>
        <xsd:appinfo>
            <tcm:ExtensionXml xmlns:tcm="http://www.tridion.com/ContentManager/5.0"/>
            <tcm:DefaultTextValue xmlns:tcm="http://www.tridion.com/ContentManager/5.0">ABCD</tcm:DefaultTextValue>
            <tcm:DefaultTextValue xmlns:tcm="http://www.tridion.com/ContentManager/5.0">ALL</tcm:DefaultTextValue>
        </xsd:appinfo>
    </xsd:annotation>
</xsd:element>

But when schema is saved it is deleting the repeated tcm:DefaultTextValue .

Is there any way to achieve it or its not possible in Tridion?

Thank you.


Solution

  • As suggested by @Nuno - this seems impossible - Although I note that you have minOccurs = 1 and maxOccurs = 2, meaning that their must always be either 1 or 2 values. Could you not just make 2 fields with different default values?

    I don't believe what you have requested is possible in any W3C Schema - Perhaps post it as a XSD tagged question also.