[html5] r2176 - [] (0) WF2: Define form.checkValidity().

whatwg at whatwg.org whatwg at whatwg.org
Sat Sep 13 03:13:35 PDT 2008


Author: ianh
Date: 2008-09-13 03:13:34 -0700 (Sat, 13 Sep 2008)
New Revision: 2176

Modified:
   index
   source
Log:
[] (0) WF2: Define form.checkValidity().

Modified: index
===================================================================
--- index	2008-09-13 01:03:43 UTC (rev 2175)
+++ index	2008-09-13 10:13:34 UTC (rev 2176)
@@ -26630,7 +26630,7 @@
 
   void <a href="#submit" title=dom-form-submit>submit</a>();
   void <a href="#reset" title=dom-form-reset>reset</a>();
-  boolean <span title=dom-form-checkValidity>checkValidity</span>();
+  boolean <a href="#checkvalidity" title=dom-form-checkValidity>checkValidity</a>();
 
   void <span title=dom-form-dispatchFormInput>dispatchFormInput</span>();
   void <span title=dom-form-dispatchFormChange>dispatchFormChange</span>();
@@ -26715,6 +26715,13 @@
    title=concept-form-reset>reset</a> the <code><a
    href="#form">form</a></code> element.
 
+  <p>If the <dfn id=checkvalidity
+   title=dom-form-checkValidity>checkValidity()</dfn> method is invoked, the
+   user agent must <a href="#statically">statically validate the
+   constraints</a> of the <code><a href="#form">form</a></code> element, and
+   return true if the constraint validation return a <i>positive</i> result,
+   and false if it returned a <i>negative</i> result.
+
   <p class=big-issue>...
 
   <h4 id=the-fieldset><span class=secno>4.9.2 </span>The <dfn
@@ -27550,8 +27557,119 @@
 
   <h4 id=constraint><span class=secno>4.9.15 </span>Constraint validation</h4>
 
-  <p class=big-issue>...
+  <p>An element is a <dfn id=candidate>candidate for constraint
+   validation</dfn> if the following conditions apply for that element:
 
+  <ul>
+   <li class=big-issue>...
+  </ul>
+
+  <p class=big-issue>An element <dfn id=satisfies
+   title=concept-fv-valid>satisfies its constraints</dfn> if ...
+
+  <hr>
+
+  <p>When the user agent is required to <dfn id=statically>statically
+   validate the constraints</dfn> of <code><a href="#form">form</a></code>
+   element <var title="">form</var>, it must run the following steps, which
+   return either a <i>positive</i> result (all the controls in the form are
+   valid) or a <i>negative</i> result (there are invalid controls) along with
+   a (possibly empty) list of elements that are invalid and for which no
+   script has claimed responsibility:
+
+  <ol>
+   <li>
+    <p>Let <var title="">controls</var> be a list of all the <a
+     href="#submittable" title=category-submit>submittable</a> elements whose
+     <a href="#form-owner">form owner</a> is <var title="">form</var>, in <a
+     href="#tree-order">tree order</a>.
+
+   <li>
+    <p>Let <var title="">invalid controls</var> be an initially empty list of
+     elements.</p>
+
+   <li>
+    <p>For each element <var title="">field</var> in <var
+     title="">controls</var>, in <a href="#tree-order">tree order</a>, run
+     the following substeps:</p>
+
+    <ol>
+     <li>
+      <p>If <var title="">field</var> is not a <a href="#candidate">candidate
+       for constraint validation</a>, then move on to the next element.
+
+     <li>
+      <p>Otherwise, if <var title="">field</var> <a href="#satisfies"
+       title=concept-fv-valid>satisfies its constaints</a>, then move on to
+       the next element.
+
+     <li>
+      <p>Otherwise, add <var title="">field</var> to <var title="">invalid
+       controls</var>.
+    </ol>
+
+   <li>
+    <p>If <var title="">invalid controls</var> is empty, then return a
+     <i>positive</i> result and abort these steps.
+
+   <li>
+    <p>Let <var title="">unhandled invalid controls</var> be an initially
+     empty list of elements.</p>
+
+   <li>
+    <p>For each element <var title="">field</var> in <var title="">invalid
+     controls</var>, if any, in <a href="#tree-order">tree order</a>, run the
+     following substeps:</p>
+
+    <ol>
+     <li>
+      <p><a href="#firing2">Fire a simple event</a> named <code
+       title=event-invalid>invalid</code> at <var title="">field</var> that
+       is cancelable.
+
+     <li>
+      <p>If the event was not canceled, then add <var title="">field</var> to
+       <var title="">unhandled invalid controls</var>.
+    </ol>
+
+   <li>
+    <p>Return a <i>negative</i> result with the list of elements in the <var
+     title="">unhandled invalid controls</var> list.
+  </ol>
+
+  <hr>
+
+  <p>If a user agent is to <dfn id=interactively>interactively validate the
+   constraints</dfn> of <code><a href="#form">form</a></code> element <var
+   title="">form</var>, then the user agent must run the following steps:
+
+  <ol>
+   <li>
+    <p><a href="#statically">Statically validate the constraints</a> of <var
+     title="">form</var>, and let <var title="">unhandled invalid
+     controls</var> be the list of elements returned if the result was
+     <i>negative</i>.
+
+   <li>
+    <p>If the result was <i>positive</i>, then return that result and abort
+     these steps.
+
+   <li>
+    <p>Report the problems with the constraints of at last one of the
+     elements given in <var title="">unhandled invalid controls</var> to the
+     user. User agents may focus one of those elements in the process. User
+     agents may report more than one constraint violation. User agents may
+     coalesce related constraint violation reports if appropriate (e.g. if
+     multiple radio buttons in a set are marked as required, only one error
+     need be reported). If one of the controls is not visible to the user
+     (e.g. it has the <code title=attr-hidden><a
+     href="#hidden1">hidden</a></code> attribute set) then user agents may
+     report a script error.
+
+   <li>
+    <p>Return a <i>negative</i> result.
+  </ol>
+
   <h4 id=form-submission><span class=secno>4.9.16 </span>Form submission</h4>
 
   <p>When a form <var title="">form</var> is <dfn id=submitted
@@ -27569,11 +27687,11 @@
 
    <li>
     <p>If the <var title="">submitter</var> is anything but a <code><a
-     href="#form">form</a></code> element, then <span>validate the
-     constraints</span> of <var title="">form</var> and examine the result:
-     if the result is negative (the constraint validation concluded that
-     there were invalid fields and informed the user of this) then abort
-     these steps.
+     href="#form">form</a></code> element, then <a
+     href="#interactively">interactively validate the constraints</a> of <var
+     title="">form</var> and examine the result: if the result is negative
+     (the constraint validation concluded that there were invalid fields and
+     probably informed the user of this) then abort these steps.
 
    <li>
     <p>If the <var title="">submitter</var> is anything but a <code><a

Modified: source
===================================================================
--- source	2008-09-13 01:03:43 UTC (rev 2175)
+++ source	2008-09-13 10:13:34 UTC (rev 2176)
@@ -24058,6 +24058,12 @@
   title="concept-form-reset">reset</span> the <code>form</code>
   element.</p>
 
+  <p>If the <dfn title="dom-form-checkValidity">checkValidity()</dfn>
+  method is invoked, the user agent must <span>statically validate the
+  constraints</span> of the <code>form</code> element, and return true
+  if the constraint validation return a <i>positive</i> result, and
+  false if it returned a <i>negative</i> result.</p>
+
   <p class="big-issue">...</p>
 
 
@@ -24687,9 +24693,124 @@
 
   <h4>Constraint validation</h4>
 
-  <p class="big-issue">...</p>
+  <p>An element is a <dfn>candidate for constraint validation</dfn> if
+  the following conditions apply for that element:</p>
 
+  <ul>
 
+   <li class="big-issue">...</li>
+
+  </ul>
+
+  <p class="big-issue">An element <dfn
+  title="concept-fv-valid">satisfies its constraints</dfn> if ...</p>
+
+  <hr>
+
+  <p>When the user agent is required to <dfn>statically validate the
+  constraints</dfn> of <code>form</code> element <var
+  title="">form</var>, it must run the following steps, which return
+  either a <i>positive</i> result (all the controls in the form are
+  valid) or a <i>negative</i> result (there are invalid controls)
+  along with a (possibly empty) list of elements that are invalid and
+  for which no script has claimed responsibility:</p>
+
+  <ol>
+
+   <li><p>Let <var title="">controls</var> be a list of all the <span
+   title="category-submit">submittable</span> elements whose
+   <span>form owner</span> is <var title="">form</var>, in <span>tree
+   order</span>.</p></li>
+
+   <li><p>Let <var title="">invalid controls</var> be an initially
+   empty list of elements.</p></l>
+
+   <li>
+
+    <p>For each element <var title="">field</var> in <var
+    title="">controls</var>, in <span>tree order</span>, run the
+    following substeps:</p>
+
+    <ol>
+
+     <li><p>If <var title="">field</var> is not a <span>candidate for
+     constraint validation</span>, then move on to the next element.</p></li>
+
+     <li><p>Otherwise, if <var title="">field</var> <span
+     title="concept-fv-valid">satisfies its constaints</span>, then
+     move on to the next element.</p></li>
+
+     <li><p>Otherwise, add <var title="">field</var> to <var
+     title="">invalid controls</var>.</p></li>
+
+    </ol>
+
+   </li>
+
+   <li><p>If <var title="">invalid controls</var> is empty, then
+   return a <i>positive</i> result and abort these steps.</p></li>
+
+   <li><p>Let <var title="">unhandled invalid controls</var> be an
+   initially empty list of elements.</p></l>
+
+   <li>
+
+    <p>For each element <var title="">field</var> in <var
+    title="">invalid controls</var>, if any, in <span>tree
+    order</span>, run the following substeps:</p>
+
+    <ol>
+
+     <li><p><span>Fire a simple event</span> named <code
+     title="event-invalid">invalid</code> at <var title="">field</var>
+     that is cancelable.</p></li>
+
+     <li><p>If the event was not canceled, then add <var
+     title="">field</var> to <var title="">unhandled invalid
+     controls</var>.</p></li>
+
+    </ol>
+
+   </li>
+
+   <li><p>Return a <i>negative</i> result with the list of elements in
+   the <var title="">unhandled invalid controls</var> list.</p></li>
+
+  </ol>
+
+  <hr>
+
+  <p>If a user agent is to <dfn>interactively validate the
+  constraints</dfn> of <code>form</code> element <var
+  title="">form</var>, then the user agent must run the following
+  steps:</p>
+
+  <ol>
+
+   <li><p><span>Statically validate the constraints</span> of <var
+   title="">form</var>, and let <var title="">unhandled invalid
+   controls</var> be the list of elements returned if the result was
+   <i>negative</i>.</p></li>
+
+   <li><p>If the result was <i>positive</i>, then return that result
+   and abort these steps.</p></li>
+
+   <li><p>Report the problems with the constraints of at last one of
+   the elements given in <var title="">unhandled invalid
+   controls</var> to the user. User agents may focus one of those
+   elements in the process. User agents may report more than one
+   constraint violation. User agents may coalesce related constraint
+   violation reports if appropriate (e.g. if multiple radio buttons in
+   a set are marked as required, only one error need be reported). If
+   one of the controls is not visible to the user (e.g. it has the
+   <code title="attr-hidden">hidden</code> attribute set) then user
+   agents may report a script error.</p></li>
+
+   <li><p>Return a <i>negative</i> result.</p></li>
+
+  </ol>
+
+
   <h4>Form submission</h4>
 
   <p>When a form <var title="">form</var> is <dfn
@@ -24706,11 +24827,11 @@
    these steps without doing anything.</p></li>
 
    <li><p>If the <var title="">submitter</var> is anything but a
-   <code>form</code> element, then <span>validate the
+   <code>form</code> element, then <span>interactively validate the
    constraints</span> of <var title="">form</var> and examine the
    result: if the result is negative (the constraint validation
-   concluded that there were invalid fields and informed the user of
-   this) then abort these steps.</p></li>
+   concluded that there were invalid fields and probably informed the
+   user of this) then abort these steps.</p></li>
 
    <li><p>If the <var title="">submitter</var> is anything but a
    <code>form</code> element, then <span>fire a simple event</span>




More information about the Commit-Watchers mailing list