Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange behavior with the novalidate attribute #21

Open
raph146 opened this issue Jan 21, 2021 · 2 comments
Open

Strange behavior with the novalidate attribute #21

raph146 opened this issue Jan 21, 2021 · 2 comments

Comments

@raph146
Copy link

raph146 commented Jan 21, 2021

Hello,
I have an issue with a form which template extends from https://github.com/moccu/django-cruditor/blob/master/cruditor/templates/cruditor/form.html.
The issue seems to originate in the "novalidate" attribute from the form tag in the template right there :
https://github.com/moccu/django-cruditor/blob/81b074dc1c943cee064e774ed0ae80a8291c5497/cruditor/templates/cruditor/form.html#L14
Basically, in my case, when I click my form's validation button, every numerical field in which there are non numerical characters or expressions are emptied before sending the POST request, instead of preventing the form validation and displaying errors.
Although I get the right behavior when I remove the "novalidate" attribute from the form tag.
Is this intended at all ? I was also wondering what purpose is the "novalidate" attribute serving in most cases.
I am relatively new to Django so I guess my question might seem trivial, I'm sorry if it is.

EDIT : To add a bit more context, I'm using Bootstrap with django-tapeforms

@stephrdev
Copy link
Owner

The novalidate tag disables the validation of field inputs in the browser. Now sure why the brower doesn't send the data to the server. Are you sure its not sent? Or is it simply not available in form.cleaned_data as it is not a valid value?

@fpoulain
Copy link
Contributor

Actually it seems to be due to browser behavior. Nothing to do with cruditor with this. And the use of novalidate seems to be a good choice since browser-side validation is sometimes broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants