SDL Tridion 2011中MultiLineText字段的MaxLength限制

Sar*_*rca 5 maxlength xsd-validation tridion tridion-2011

我的架构源如下所示:

<xsd:schema xmlns="uuid:b8fd4596-56ec-4718-ad00-bf2a70a148c2" xmlns:tcmi="http://www.tridion.com/ContentManager/5.0/Instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="uuid:b8fd4596-56ec-4718-ad00-bf2a70a148c2">
<xsd:import namespace="http://www.tridion.com/ContentManager/5.0/Instance"></xsd:import>
<xsd:annotation>
    <xsd:appinfo>
        <tcm:Labels xmlns:tcm="http://www.tridion.com/ContentManager/5.0">
            <tcm:Label ElementName="description" Metadata="false">Description</tcm:Label>
            <tcm:Label ElementName="multiline" Metadata="false">Multiline</tcm:Label>
        </tcm:Labels>
    </xsd:appinfo>
</xsd:annotation>
<xsd:element name="Blog">
    <xsd:complexType>
        <xsd:sequence>
            <xsd:element name="description" minOccurs="0" maxOccurs="1">
                <xsd:annotation>
                    <xsd:appinfo>
                        <tcm:ExtensionXml xmlns:tcm="http://www.tridion.com/ContentManager/5.0"></tcm:ExtensionXml>
                    </xsd:appinfo>
                </xsd:annotation>
                <xsd:simpleType>
                    <xsd:restriction base="xsd:normalizedString">
                        <xsd:minLength value="1"></xsd:minLength>
                        <xsd:maxLength value="20"></xsd:maxLength>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:element>
            <xsd:element name="multiline" minOccurs="0" maxOccurs="1" type="tcmi:MultiLineText">
                <xsd:annotation>
                    <xsd:appinfo>
                        <tcm:ExtensionXml xmlns:tcm="http://www.tridion.com/ContentManager/5.0">
                            <configuration xmlns="http://www.sdltridion.com/2011/SiteEdit">
                                <field>
                                    <editable>true</editable>
                                </field>
                            </configuration>
                        </tcm:ExtensionXml>
                        <tcm:Size xmlns:tcm="http://www.tridion.com/ContentManager/5.0">5</tcm:Size>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
</xsd:element></xsd:schema>
Run Code Online (Sandbox Code Playgroud)

我能够对"xsd:normalizedString"类型字段使用maxlengthminLength限制,但是我无法对"tcmi:MultiLineText"类型使用相同的限制.任何人都知道如何在这种类型的领域使用它们?

如果在该字段中无法使用该限制,我知道还有其他方法可以在Tridion中验证保存内容(正如Nuno和Robert在http://nunolinhares.blogspot.com.es/2012/07/validating中所解释的那样)-content-on-save-part-1-of.htmlhttp://www.curlette.com/?p=913,谢谢你的工作!)但我希望找到一个避免使用事件的解决方案.还有其他想法吗?

Chr*_*ers 8

不幸的是,这不能在多行字段上完成.这适用于启用RTF的字段和多行纯文本字段.

这是设计(实际上很有意义),因为尝试限制文本通常与文本使用的空间量有关,并且这些字段支持换行符(以及启用RTF的字段中的其他格式)因此字符串长度与文本使用的空间几乎没有关系.

如果您的字段是RTF字段,则可以编写"截断"XSLT以应用于文本.否则,您将需要使用上面引用的解决方案之一.

或者,如果文本太长,您可以考虑使用输出模板截断文本.