I've found a problem related to xmlcontents. It's about the Editor and the time when validation rules are triggered.<br><br>It appears in Opencms 6.2.1 and 6.2.2.<br><br>These are the steps to reproduce it:<br><br>Firstly, I've defined a new content (Pages). It's a multilingual content (the language is selected from a Combo). Each Page has two elements, a Title and a Paragraph.
<br>The Title must not be empty (required field), so I've created a validation rule that checks that constraint (regex="!^\s*$" ).<br><br>The schema definition is as follows:<br><br>###########################################
<br><br><xsd:schema xmlns:xsd="<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>" elementFormDefault="qualified"><br><br> <xsd:include schemaLocation="opencms://opencms-
xmlcontent.xsd"/><br><br> <xsd:element name="Pages" type="OpenCmsPages"/><br> <xsd:complexType name="OpenCmsPages"><br> <xsd:sequence><br> <xsd:element name="Page" type="OpenCmsPage" minOccurs="0" maxOccurs="unbounded"/>
<br> </xsd:sequence><br> </xsd:complexType><br><br> <xsd:complexType name="OpenCmsPage"><br> <xsd:sequence><br> <xsd:element name="Title" type="OpenCmsString" />
<br> <xsd:element name="Paragraph" type="OpenCmsString" /><br> </xsd:sequence><br> <xsd:attribute name="language" type="OpenCmsLocale" use="optional"/>
<br> </xsd:complexType><br><br> <xsd:annotation><br> <xsd:appinfo><br> <validationrules><br> <rule element="Title" regex="!^\s*$" message="${
key.editor.errormessage.Page.Title.required|${validation.path}}" /><br> <layouts><br> <layout element="Paragraph" widget="HtmlWidget" /><br> </layouts>
<br> </xsd:appinfo><br> </xsd:annotation><br></xsd:schema><br><br>###########################################<br><br>Secondly, I configured a new resource type (in opencms-vfs.xml) and a "New File" menú entry (
opencms-workplace.xml) for that content.<br><br>All works fine. I can create a new Page, using the "New" button.<br><br>The problem appears when editing the content (from the visual xmlcontent editor, selecting "Edit", not selecting "Edit sourcecode").
<br><br>As I stated before, it's a multilingual content. When you edit the content, a language is just selected (the default one). The validation rules aren't triggered until you press the save button. The edition for the default language works fine. The rules are checked only when you press the button.
<br><br>But the problem comes when you select another language (from the combo). <br><br>At the time you select another language, the validation rules are triggered. The fields are empty the first time you edit a content in a language. As the fields for the language we've selected are empty, the validation engine throws an error (the Title field mus not be empty).
<br><br>The worst thing is that you're returned automatically to the previous language form, so you can't edit the content in another language.<br><br>I think it is a bug. There was a similar bug previously, which was fixed:
<br><br>###########################################################<br><br>"We are running on 6.0.2. In one of our xsd files, we put in a validation<br>rule to ensure that this field is populated (a required field). So the
<br>validation rule was:<br><br><br><br><validationrules><br><br><rule element="Title" regex="!^\s*$" type="warning"<br>message="Title field should not be left empty" />
<br><br></validationrules><br><br><br><br>The problem is that this error shows up when we create a new piece of<br>structured content. Why isn't the validation rule only called on save or<br>did we do something wrong? "
<br><br>" We actually sent this into Alkacon and they patched it in the 6.2 branch. So yes it was addressed, but no it doesn't work in any of the code probably more recent than like 10 days ago.<br><br>Joel "<br>
<br>###########################################################<br><br><br>I send this problem to the mailing list first, as advised. <br>If it's really a bug, please report it.<br><br>Thank you.