1

So, I have an item with a couple of fields that have required validation rules.

I've added a validation action when executing a workflow action (submitting to admin for approval). When I do this a modal comes up that shows the fields and whether they have validated.

When I intentionally leave the required fields blank, it flags them as being required. However, in addition to this, under the "Item" section, there's a row that has "Is rendered item valid XHTML document.The item must render as a valid XHTML document." in the left column, and in the right column it says:

An error occurred while validating: Object reference not set to an instance of an object.`"

instead of OK.

I'm wondering what it's tripping up on and how to get rid of this so as not to confuse users? When I fill the required fields in, I can execute the workflow action successfully.

1

As suggested by Marek Musielak.

You can fix this issue with below approaches:

First Approach

There is no validation schema for HTML5 available yet. However, it is possible to extend the current XSD schema that Sitecore uses for XHTML validation to allow some of the HTML5 tags. The original schema file is located and specified in the XHtmlSchemaFile setting in web.config:

<setting name="XHtmlSchemaFile" value="/sitecore/shell/schemas/sitecore xhtml.xsd" />

For example, to allow the tag, you should modify the schema file as follows:

Create a new xs:element node under the root node for the <article> tag:

<xs:element name="article">
    <xs:complexType mixed="true">
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:group ref="block" />
        <xs:group ref="inline" />
        <xs:group ref="misc" />
      </xs:choice>
      <xs:attributeGroup ref="coreattrs" />
    </xs:complexType>
  </xs:element>

Add the newly created element definition to the group of block elements:

<xs:group name="block">
    <xs:choice>
      <xs:element ref="p" />
      <xs:group ref="heading" />
      <xs:element ref="div" />
      <xs:group ref="lists" />
      <xs:group ref="blocktext" />
      <xs:element ref="fieldset" />
      <xs:element ref="table" />
      <xs:element ref="article" />
    </xs:choice>
  </xs:group>

Second Approach

Alternatively, it is possible to disable XHTML validation so that items with HTML5 markup can be approved in a workflow. To do this, remove Full Page XHtml and Is Xhtml rules from the Workflow field of the following items:

/sitecore/system/Settings/Validation Rules/Field Types/Rich Text

enter image description here

/sitecore/system/Settings/Validation Rules/Global Rules

enter image description here

Reference: https://kb.sitecore.net/articles/941511

-1

You can get rid of XHTML validation by:

  1. Navigate to /sitecore/system/Settings/Validation Rules/Field Types/YourFieldType
  2. Go to the Workflow field under "Validation Rules" and deselect the Is Xhtml rule. enter image description here
  • I'm not a fan of this approach because it modifies default templates and could be overridden by an upgrade. – Dan Sinclair May 10 '19 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.