<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xforms="http://www.w3.org/2002/xforms">
  <head>
    <title>11.2.g Order of validation and resource errors in submit preprocessing</title>
    
    <script src="../../../../../src/ubiquity-loader.js" type="text/javascript">/**/</script>
    <link href="../../../Edition1/driverPages/forms/TestSuite11.css" rel="stylesheet"/>
    
  </head>
  <body>
    <xforms:model id="m1">
       <xforms:instance>       
          <car xmlns="">
          	<make></make>
          	<model>Prius</model>
          </car>
       </xforms:instance>
       
       <!-- make element is invalid but non-relevant -->
       <xforms:bind nodeset="make" required="true()" relevant="false()"></xforms:bind>
       
       <!-- Test validation-error before resource-error (invalid due to inclusion of non-relevant node "make") -->
       <xforms:submission id="s1" ref="/car" relevant="false" method="post" replace="none">
       		<xforms:message ev:event="xforms-submit-done" level="modal">xforms-submit-done (FAIL TEST)</xforms:message>
       		<xforms:message ev:event="xforms-submit-error" level="modal"
       		     if="event('error-type') = 'validation-error'">xforms-submit-error (PASS TEST)</xforms:message>
       		<xforms:message ev:event="xforms-submit-error" level="modal"
       		     if="event('error-type') != 'validation-error'">xforms-submit-error (FAIL TEST)</xforms:message>
       </xforms:submission>
       
       <!-- Test resource-error after validation -->
       <xforms:submission id="s2" ref="/car" method="post" replace="none">
       		<xforms:message ev:event="xforms-submit-done" level="modal">xforms-submit-done (FAIL TEST)</xforms:message>
       		<xforms:message ev:event="xforms-submit-error" level="modal"
       		     if="event('error-type') = 'resource-error'">xforms-submit-error (PASS TEST)</xforms:message>
       		<xforms:message ev:event="xforms-submit-error" level="modal"
       		     if="event('error-type') != 'resource-error'">xforms-submit-error (FAIL TEST)</xforms:message>
       </xforms:submission>
       
    </xforms:model>
  	<xforms:group>
	  	<xforms:label class="title">11.2.g Order of validation and resource errors in submit preprocessing</xforms:label>
	</xforms:group>
	<xforms:group>
		<xforms:label>Each submit control below must produce a message "xforms-submit-error (PASS TEST)"</xforms:label>
	</xforms:group>
	<xforms:submit submission="s1">
	   <xforms:label>Test validation-error before resource-error</xforms:label>
	</xforms:submit>
	<xforms:submit submission="s2">
	   <xforms:label>Test resource-error after no-data and validation tests</xforms:label>
	</xforms:submit>
  </body>
</html>
