Reputation: 64820
How do you disable client-side JS form field validation in Django's admin, specifically for URLFields?
I have a client that doesn't want to enter "http://" for all URL fields, which seems reasonable. This is easy to do with the server-side form validation, but the client-side still prevents the form from being submitted unless the user enters "http://". How do I turn that off, just for that field? I'm looking through the code for models.URLField/forms.URLField/URLValidator, but I don't see an easy way to turn it off without reimplementing the widget.
Edit: Example of the JS validation I want to disable.
Upvotes: 8
Views: 2974
Reputation: 599876
As I said in the comment, Django doesn't do any client-side validation. The error you're seeing is coming from the browser's own HTML5 validation: see this website for an example and explanation.
You can disable HTML5 validation by adding novalidate
to the surrounding form
element.
Upvotes: 11