hungdt138 / html5rocks

Automatically exported from code.google.com/p/html5rocks
0 stars 0 forks source link

triggering contextual error message for inputs #826

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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)

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 inputs 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 in MDC, nor into inspecting <input>
and <form> elements.

Sorry my french.
Xavier Mouton-Dubosc
  http://Dascritch.com
  @dascritch 

Original issue reported on code.google.com by xavie...@gmail.com on 15 Feb 2012 at 10:19

GoogleCodeExporter commented 9 years ago
This is an issue tracker, not stack overflow :)

Original comment by ericbide...@html5rocks.com on 2 Mar 2012 at 6:55