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

disabled field fills wrong initial value #64

Open
fboerman opened this issue Oct 6, 2020 · 4 comments
Open

disabled field fills wrong initial value #64

fboerman opened this issue Oct 6, 2020 · 4 comments

Comments

@fboerman
Copy link

fboerman commented Oct 6, 2020

Hi, I have an enumfield that I have disabled as part of a form with disabled=True. however then the validation always validates the field as being wrong.

After some debugging I found this is due to the fact that the value given to clean differs if the field is disabled or not. when it is not disabled it is a string containing a number if it is disabled it is a string containing the string name of the enum option.

I have spend quite some time thinking about a solution myself but cant get it right. Does any of the maintainers have an idea? Thanks in advance!

@ghost
Copy link

ghost commented Nov 5, 2021

About a year too late but ... 😅 Did you forget to set the field to required=False?
I get an empty string when I disable the field + set required to false (which is intended behavior as far as I can tell.)

The form validates.

@Mojken
Copy link

Mojken commented Nov 11, 2021

This seems like it shouldn't be open anymore, close it?

@fboerman
Copy link
Author

About a year too late but ... sweat_smile Did you forget to set the field to required=False? I get an empty string when I disable the field + set required to false (which is intended behavior as far as I can tell.)

The form validates.

do you mean explicitely setting it instead of leaving it open as the default?

@ghost
Copy link

ghost commented Nov 19, 2021

I mean explicitly setting required=False in the form class.

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

2 participants