This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 16051 - Triggering contextual error message for inputs
Summary: Triggering contextual error message for inputs
Status: RESOLVED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: HTML5 spec (show other bugs)
Version: unspecified
Hardware: PC Linux
: P3 enhancement
Target Milestone: ---
Assignee: Robin Berjon
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-21 08:18 UTC by Xavier Mouton-Dubosc
Modified: 2015-06-26 05:36 UTC (History)
4 users (show)

See Also:


Attachments

Description Xavier Mouton-Dubosc 2012-02-21 08:18:08 UTC
Hi everyone

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

For a <form> 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't see any reference to that, nor into inspecting <input>
and <form> 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
Comment 1 contributor 2012-07-18 06:56:03 UTC
This bug was cloned to create bug 17826 as part of operation convergence.
Comment 2 Michael[tm] Smith 2012-10-22 10:59:42 UTC
Hixie responded to the upstream clone of this bug:

https://www.w3.org/Bugs/Public/show_bug.cgi?id=17826#c1

Xavier, can you please reply here to confirm whether you're satisfied with that response.
Comment 3 Xavier Mouton-Dubosc 2012-10-22 12:04:54 UTC
Sorry, I completely missed to answer.

I did it by not using the async feature of jquery : $.post first,  then return to let <form> fail.

A clever way to do the job, but i'm still thinking that we perhaps need a way to trigger the interactive mode.
Comment 4 Michael[tm] Smith 2012-10-22 12:10:37 UTC
(In reply to comment #3)
> Sorry, I completely missed to answer.
> 
> I did it by not using the async feature of jquery : $.post first,  then
> return to let <form> fail.
> 
> A clever way to do the job, but i'm still thinking that we perhaps need a
> way to trigger the interactive mode.

OK, I'll re-open this for now but I have to say that this is not likely to be a feature that gets considered for inclusion in the W3C HTML 5.0 spec. I think it probably needs to be moved to HTML.next for consideration as a feature in HTML 5.1
Comment 5 Michael[tm] Smith 2015-06-16 11:40:50 UTC
Resolving per https://www.w3.org/Bugs/Public/show_bug.cgi?id=17826#c9