<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>17826</bug_id>
          
          <creation_ts>2012-07-18 06:56:01 +0000</creation_ts>
          <short_desc>Triggering contextual error message for inputs</short_desc>
          <delta_ts>2013-10-03 21:59:32 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>2013 Q4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>annevk</cc>
    
    <cc>darin</cc>
    
    <cc>dglazkov</cc>
    
    <cc>ian</cc>
    
    <cc>james</cc>
    
    <cc>micdesim</cc>
    
    <cc>michelangelo</cc>
    
    <cc>mike</cc>
    
    <cc>mounir</cc>
    
    <cc>ojan</cc>
    
    <cc>roc</cc>
    
    <cc>tkent</cc>
    
    <cc>travil</cc>
    
    <cc>xaviermd</cc>
    
    <cc>zcorpan</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>70122</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2012-07-18 06:56:01 +0000</bug_when>
    <thetext>This was was cloned from bug 16051 as part of operation convergence.
Originally filed: 2012-02-21 08:18:00 +0000
Original reporter: Xavier Mouton-Dubosc &lt;xaviermd@gmail.com&gt;

================================================================================
 #0   Xavier Mouton-Dubosc                            2012-02-21 08:18:08 +0000 
--------------------------------------------------------------------------------
Hi everyone

I&apos;m actually dev&apos;ing on a intranet application in HTML5 with XHR (so
sorry, but i can&apos;t give access to any example). You can see a test there : http://jsfiddle.net/bz88V/

For a &lt;form&gt; I wish on make an XHR, I test the validity of the form,
like this :

if (form.checkValidity())
{
  $.post([...]);
} else {

   errormessages();

}

on the same way, into the return of the post (the [...] part), i can
have error validating messages from the server. So I attach them to
the inpts like this :
input.setCustomValidity(le_error_message);
le_error_message is really attached as I can see into
input.validationMessage
the :invalid css selector is set to the input but...

How can I trigger the browser (firefox, chrome, etc...) to display
their standard contextual error-message ?

I tried form.submit(), but it will really submit the form, even
skipping what I wish the browser should do.
I can&apos;t see any reference to that, nor into inspecting &lt;input&gt;
and &lt;form&gt; elements.


French speaking paper http://dascritch.net/post/2012/02/21/Validations-complexes-de-HTML5-farcies-au-Javascript

Sorry my french.
Xavier Mouton-Dubosc
  http://Dascritch.com
  @dascritch
================================================================================</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>74562</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-09-26 18:34:37 +0000</bug_when>
    <thetext>Just catch the form submission using a regular submit button, as in:

   &lt;form action=&quot;javascript:void(0)&quot; onsubmit=&quot;submitted()&quot;&gt;

...or some such, instead of doing the submission yourself with checkValidity(), etc.

Does that work?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76900</commentid>
    <comment_count>2</comment_count>
    <who name="Xavier Mouton-Dubosc">xaviermd</who>
    <bug_when>2012-10-22 12:09:26 +0000</bug_when>
    <thetext>Sorry to not have answered in time.

I did it by not using the async mode of $.post in jquery, then fallback to the normal event to have the form failing.

The code became
if (form.checkValidity())
{
   $.ajax({ async : false });
   // populating the returned errors into custom validity
}

return true;

BTW, using javascript: link or on*=&quot;&quot; attribute is really ugly ;)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76919</commentid>
    <comment_count>3</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-10-22 18:37:25 +0000</bug_when>
    <thetext>Why is it ugly?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78725</commentid>
    <comment_count>4</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-11-24 04:21:10 +0000</bug_when>
    <thetext>This bug is not the only request I&apos;ve seen for a way to explicitly trigger the user agent&apos;s form validation UI. Maybe we should add something after all.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94196</commentid>
    <comment_count>5</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-10-02 20:08:57 +0000</bug_when>
    <thetext>I&apos;m thinking we should supplement every checkValidity() method with a reportValidity() method. On the &lt;form&gt; element it would be the same as checkValidity() except for invoking &quot;interactively validate the constraints&quot; rather than &quot;statically validate the constraints&quot;. On form controls, it would do the same but only looking at that one form control.

Any objections?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94197</commentid>
    <comment_count>6</comment_count>
    <who name="Xavier Mouton-Dubosc">xaviermd</who>
    <bug_when>2013-10-02 20:20:27 +0000</bug_when>
    <thetext>This seems good.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94228</commentid>
    <comment_count>7</comment_count>
    <who name="Kent Tamura">tkent</who>
    <bug_when>2013-10-03 14:05:59 +0000</bug_when>
    <thetext>(In reply to Ian &apos;Hixie&apos; Hickson from comment #5)
&gt; I&apos;m thinking we should supplement every checkValidity() method with a
&gt; reportValidity() method. On the &lt;form&gt; element it would be the same as
&gt; checkValidity() except for invoking &quot;interactively validate the constraints&quot;
&gt; rather than &quot;statically validate the constraints&quot;. On form controls, it
&gt; would do the same but only looking at that one form control.

It sounds good.
We&apos;d like to implement it in Blink.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94279</commentid>
    <comment_count>8</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-10-03 21:59:25 +0000</bug_when>
    <thetext>Ok, done.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94280</commentid>
    <comment_count>9</comment_count>
    <who name="">contributor</who>
    <bug_when>2013-10-03 21:59:32 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r8210.
Check-in comment: Add reportValidity(), which is like checkValidity() but triggers the browser&apos;s error-reporting UI as well
http://html5.org/tools/web-apps-tracker?from=8209&amp;to=8210</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>