Closed soult closed 9 years ago
It's a good idea to have is_required which is a new standard.
If you're in a hurry, be sure that such a pull request will be accepted: https://github.com/django/django/commit/bc21e9c0d9253f9d49a0063830a645d1c724c696
Thanks
The problem is that the Django Bootstrap3 app already sets the required attribute. I have created a small example app to demonstrate the problem: https://github.com/soult/django-autocomplete-light/tree/issue-325
If you run the app, try entering an animal (start with 'ca' or 'do'), then select it. The Autocomplete Light JavaScript will remove the "ca" string from the "#id_animal-autocomplete" input element and add "cat" to the "#id_animal" select element. But because "#id_animal-autocomplete" has the "required" attribute set by the Bootstrap3 app, you can not submit the form.
Does this work for you ?
$('#id_animal-autocomplete').removeAttr('required')
Any feedback ? please reopen ;)
I am using the autocomplete light extension with the django-bootstrap3 extension.
When I use the
bootstrap_form
templatetag instead of the usualform.as_p
or similar, the boostrap extension adds a "required" attribute to the input HTML tag. Browsers that support the tag will then not let me submit the form.My current workaround is to manually set the
is_required
attribute toFalse
for all autocomplete widgets. You can see the check used by django-bootstrap3 here.Do you think it would be useful to automatically set the
is_required
attribute on all autocomplete widgets?