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

boolean field always ask for true value #22

Open
bedros opened this issue Dec 17, 2015 · 6 comments
Open

boolean field always ask for true value #22

bedros opened this issue Dec 17, 2015 · 6 comments

Comments

@bedros
Copy link

bedros commented Dec 17, 2015

When I create a boolean field, it will not accept the form unless I set it to TRUE.

@MarkusH
Copy link
Owner

MarkusH commented Dec 17, 2015

Obviously, please set required=False according to the Django docs

@bedros
Copy link
Author

bedros commented Dec 17, 2015

actually, I'm aware that you can set required=false; however the example project does not accept the boolean field unless its value entered is true, making the example project not functioning correctly unless the user edits the project.

@MarkusH
Copy link
Owner

MarkusH commented Jan 1, 2016

Ah, that sounds legit.

@MarkusH MarkusH reopened this Jan 1, 2016
@dcale
Copy link

dcale commented May 13, 2016

I have a similar issue. Boolean fields always require to be ticked for the form to submit. In the code I discovered this:

@dynamic_form_field
class BooleanField(BaseDynamicFormField):

    cls = 'django.forms.BooleanField'
    display_label = _('Boolean')

    class Meta:
        _exclude = ('required',)

Removing the Meta completely fixes the issue because I can decide on my own if the field is required to be ticked or can be left blank. Now I don't really understand why that exclude was added and would suggest to remove it.

@MarkusH
Copy link
Owner

MarkusH commented Jun 2, 2016

Do you want to provide a pull request + patch for that? Happy to review it 😄

@bedros
Copy link
Author

bedros commented Nov 9, 2016

after thinking about a use case; I think it's right the way it's right now.

Example,

a form may have boolean at end of the form for the following question

check here X to accept the agreement; the checkbox must be True for the form to be submitted successfully, therefore, in this case, the developer sets this booleanfield as required. and it should only be accepted if it's value is True, the same as current behavior

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

No branches or pull requests

3 participants