These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:14 pm Advanced search

Programmatically close an HTML5 form validation error?

If you are stuck or have questions regarding HTML or other Web technologies, ask your questions here. No question too dumb!

Programmatically close an HTML5 form validation error?

Postby XP1 » Sun Sep 11, 2011 11:09 am

How to programmatically close an HTML5 form validation error message?

I originally posted this question on Stack Overflow but didn't find an official cross-browser way to close the error messages:
http://stackoverflow.com/questions/7353 ... or-message

@Garrett Vlieger discovered a hack that works in :opera: Opera 11.51 Build 1087 and :firefox: Firefox 6.0.2:
Code: Select all
inputElement.blur();
inputElement.focus();

However, it doesn't work in :chr: Chrome 15.0.874.5 dev-m (or older).

When the user starts typing again, I want to close the form validation error message.
User avatar
XP1
<h6>
 
Posts: 3
Joined: Sun Sep 11, 2011 10:10 am

Re: Programmatically close an HTML5 form validation error?

Postby zcorpan » Thu Sep 13, 2012 9:43 am

Do you never want to see the error message?
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Re: Programmatically close an HTML5 form validation error?

Postby XP1 » Thu Sep 13, 2012 1:37 pm

zcorpan wrote:Do you never want to see the error message?
I want the error message, but after something happens, I want to be able to close it.
User avatar
XP1
<h6>
 
Posts: 3
Joined: Sun Sep 11, 2011 10:10 am

Re: Programmatically close an HTML5 form validation error?

Postby zcorpan » Thu Sep 13, 2012 4:35 pm

Do you want it to close when the user starts typing, because you think that is a better user experience?
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Re: Programmatically close an HTML5 form validation error?

Postby XP1 » Thu Sep 13, 2012 5:49 pm

zcorpan wrote:Do you want it to close when the user starts typing, because you think that is a better user experience?
Yes.
User avatar
XP1
<h6>
 
Posts: 3
Joined: Sun Sep 11, 2011 10:10 am

Re: Programmatically close an HTML5 form validation error?

Postby zcorpan » Thu Sep 13, 2012 6:28 pm

Wouldn't it be better if browsers did that by default for all sites? Please file bugs on browsers. :)
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden


Return to Help & Advice

Who is online

Users browsing this forum: No registered users and 0 guests