DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25504>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25504

[PATCH] context of violation in schema validator of jxforms fixed

           Summary: [PATCH] context of violation in schema validator of
                    jxforms fixed
           Product: Cocoon 2
           Version: Current CVS 2.1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: CocoonForms
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


When a schematron validation leads to a violation in a jxform the context of the
violation was set wrong. As a result the violation is not inserted in the
violation section of the element that coursed the violation. Instead it is only
inserted into main violation section. Please see the following example for details:

Form definition looks something like this:
[..]
<xf:form [..]>
 <error>
  <xf:violations class="error"/>
 </error>  
 <xf:input ref="/name">
  <xf:label>Name:</xf:label>
  <xf:violations class="error"/>
 </xf:input>
 [..]
</xf:form>

Schematron file:
[..]
<phase id="schema-login">
 <active pattern="user"/>
</phase>
<pattern name="User Info Validation Pattern" id="user">
 <rule context="/name">
  <assert test="string-length(.) &gt; 2">Username should be at least 3
characters.</assert>
 </rule>
</pattern>

When entering name less than 3 chars before the patch we get:
[..]
<xf:form [..]>
 <error>
  <violation xmlns="http://apache.org/cocoon/jxforms/1.0"; class="error"
ref="/[EMAIL PROTECTED]'name']">Username should be at least 3 characters.</violation>
 </error> 
 <xf:input ref="/name">
  <xf:label>Name:</xf:label> 
 </xf:input>
 [..]
</xf:form>

After applying the patch now we get:
[..]
<xf:form [..]>
 <error>
  <violation xmlns="http://apache.org/cocoon/jxforms/1.0"; class="error"
ref="/name">Username should be at least 3 characters.</violation>
 </error> 
 <xf:input ref="/name">
  <xf:label>Name:</xf:label> 
  <violation xmlns="http://apache.org/cocoon/jxforms/1.0"; class="error"
ref="/name">Username should be at least 3 characters.</violation>
 </xf:input>
 [..]
</xf:form>

Reply via email to