Disable form validation in browser
Asked Answered
O

5

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?

Omari answered 22/2, 2012 at 17:7 Comment(1)
Possible duplicate of Disable validation of HTML5 form elementsBucher
A
57

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.

Ambulate answered 22/2, 2012 at 17:12 Comment(7)
I do not want to disable the validation in my code but in the browserOmari
Thanks for that, its the same es Diodes postet. It works for me, thank you!Omari
about:flags is deprecated. Use chrome://flags insteadGuinn
Is there something like chrome://flags available for firefox (to disable html5 validation in browser)?Bennink
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.116Philately
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)Philately
cannot find Disable HTML5 interactive form validation in Chrome flagsImmaterial
D
2

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

HTML5 Form validation errors remover

Dibble answered 24/4, 2014 at 1:24 Comment(2)
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.Sapless
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 answerPhilately
N
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"

Neither answered 4/5, 2020 at 10:22 Comment(0)
I
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).

Intrusion answered 22/5, 2016 at 18:1 Comment(1)
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 answerPhilately
P
-4

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.

Picul answered 22/2, 2012 at 17:9 Comment(4)
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 adressOmari
I believe this has been answered here: #3090869Picul
I've read this post but I've overlooked one commend which explains that there is a chrome://flags to en-/disable the validation.Omari
This does not answer the question at all.Guinn

© 2022 - 2024 — McMap. All rights reserved.