-
-
Notifications
You must be signed in to change notification settings - Fork 201
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 fields are submitted and saved #1279
Comments
@goldmont what exactly are you expecting to happen? |
Hi, I expect the default attributes to be overridden when the record exists. Furthermore, I expect the already existing attribute value to be saved again. For example, |
@goldmont I don't think the attributes array supports being overridden like that to specify a default value. Why aren't you using the |
I didn't mean to change the value inside the However, I prefer the |
Hmm, I see that method of setting default values is the supported way to do it in Laravel: https://stackoverflow.com/a/39912500. When you have is_activated true and you disable the switch, is that switch visually appearing as toggled on or off? |
Yes, it's toggled. After saving, it turns off. |
Winter CMS Build
1.2
PHP Version
8.1
Database engine
MySQL/MariaDB
Plugins installed
No response
Issue description
Hi there,
I have a switch field named
is_activated
in theUser
form that gets disabled once the user is activated. In myUser
model, I also have a default value for the attributeis_activated
:However, for some reason, when I submit the form (context is always
update
) the disabled switch is submitted too and the valuefalse
is saved for the fieldis_activated
. Thus the user is not activated anymore.Request payload:

How can I solve? Thanks.
Steps to replicate
Workaround
The solution, for now, seems to be to not disable form fields.
The text was updated successfully, but these errors were encountered: