17

I'm coding on a website with forms and use HTML5 validation - no rocket science so far. Everything works fine for me in Google Chrome, but I want to get sure that even a IE 6 user with no formvalidation does not insert malformed data into my MYSQL database.

Is there any way to turn off the HTML5 form validation in Google Chrome or some other state-of-the-art browser to test the serverside data validation?

i_am_jorf
  • 53,608
  • 15
  • 131
  • 222
Gerrit
  • 641
  • 1
  • 5
  • 19
  • Possible duplicate of [Disable validation of HTML5 form elements](http://stackoverflow.com/questions/3090369/disable-validation-of-html5-form-elements) – P.S. Nov 25 '16 at 16:22

5 Answers5

58

To disable validation in HTML5 use

<form method="post" action="/foo" novalidate>...</form>

Refer this question for more details.I think Junit can also help to test server side validations.
Use parameterized query to gain more security. (If SQL query is formed using user input).


EDIT :

You can set it in About:flags
Steps:
1. On your Google Chrome address bar, type “about:flags” (without the quote) and press Enter.
2.Scroll down the list until you see the option “Disable HTML5 interactive form validation”.
3.Click the enable link.
Check : http://wikibin.org/articles/google-chrome-about-and-chrome-urls.html


EDIT 2 :
Just came to know that About:flags is depreciated use Use chrome://flags instead. Thanks @Max.

Community
  • 1
  • 1
Ajinkya
  • 22,324
  • 33
  • 110
  • 161
  • I do not want to disable the validation in my code but in the browser – Gerrit Feb 22 '12 at 17:21
  • Thanks for that, its the same es Diodes postet. It works for me, thank you! – Gerrit Feb 22 '12 at 20:34
  • about:flags is deprecated. Use chrome://flags instead – bot47 Apr 10 '12 at 08:02
  • Is there something like `chrome://flags` available for firefox (to disable html5 validation in browser)? – Bogdan Nov 07 '12 at 12:15
  • 6
    This answer appear no longer valid in 2016 as there is no “Disable HTML5 interactive form validation” (or anything like it) in my version of Chrome. I am on Mac OS X with Chrome Version 53.0.2785.116 – Jason FB Oct 05 '16 at 13:05
  • Although this used to be the best answer, it is no longer. I can't seem to downvote (SO locked me out for too much voting!). But see @Bradley Flood answer (currently the last answer) – Jason FB Oct 05 '16 at 13:15
  • cannot find Disable HTML5 interactive form validation in Chrome flags – mlwacosmos Mar 20 '23 at 13:09
2

This Chrome extension allows you to disable Chrome's built in HTML validation

HTML5 Form validation errors remover

Bradley Flood
  • 10,233
  • 3
  • 46
  • 43
  • I tried this, but the problem is you have to press the button every time you refresh the page. Not very efficient while doing the testing. – haris Nov 13 '15 at 10:56
  • I tried both extensions. this one.. "HTML5 Form validation errors remover offered by Damien Alexandre" lets you turn it on when you need it. The other one in the other answer is fixed so that it disables HTML5 form validation all of the time. Since the question was asked in the context of debugging for a developer, as a developer I'd prefer to hit the button explicitly rather than install something that would permanently change my browser. For this reason, I am upvoting this answer – Jason FB Oct 05 '16 at 13:12
2

It now requires novalidate="novalidate" as below:

<Form novalidate="novalidate" onSubmit={this.handleSaveFormSubmit}>

Just novalidate no longer works, and Chrome displays "Please fill out this field"

zmechanic
  • 1,842
  • 21
  • 27
0

Unfortunately, the accepted answer doesn't work anymore since it was introduced in case the form validation was buggy (see removal requests).

Luckily, there is a chrome extension that does that for us for every page: Auto remove HTML5 form validation .

I'm not the author of this plugin and I cannot guarantee you that it doesn't do anything it isn't supposed to. The source code is very short, though (about 5 lines).

Matt3o12
  • 4,192
  • 6
  • 32
  • 47
  • I tried both extensions "Auto remove HTML5 form validation offered by Tobias Nyholm" removes all HTML5 validation at all times. The other one (listed in answer by @Bradley Flood) which is listed in Chrome extension store as "HTML5 Form validation errors remover offered by Damien Alexandre" lets you turn it on when you need it. For this reason I am upvoting the other answer – Jason FB Oct 05 '16 at 13:10
-3

You should absolutely be validating on the server if you are building any SQL strings.

In the client you should be able to fall-back to JavaScript-based validation, but that's no protection. Do it on the server as well.

Diodeus - James MacFarlane
  • 112,730
  • 33
  • 157
  • 176
  • 3
    Yes thats what I want to do. I totaly agree to you! For this reason I want to disable the browser validation to test my serverside script. Unfortunally Chrome does not allow me to send the form without setting the required fields and entering a formaly correct email adress – Gerrit Feb 22 '12 at 17:12
  • 3
    I believe this has been answered here: http://stackoverflow.com/questions/3090369/disable-validation-of-html5-form-elements – Diodeus - James MacFarlane Feb 22 '12 at 17:14
  • I've read this post but I've overlooked one commend which explains that there is a chrome://flags to en-/disable the validation. – Gerrit Feb 22 '12 at 17:20
  • 6
    This does not answer the question at all. – bot47 Apr 10 '12 at 08:03