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 fields are submitted and saved #1279

Open
goldmont opened this issue Jan 4, 2025 · 0 comments
Open

Disabled fields are submitted and saved #1279

goldmont opened this issue Jan 4, 2025 · 0 comments

Comments

@goldmont
Copy link
Contributor

goldmont commented Jan 4, 2025

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 the User form that gets disabled once the user is activated. In my User model, I also have a default value for the attribute is_activated:

public $attributes = [
	'is_banned' => false,
	'is_activated' => false,
	'ldap_authenticated' => false,
];

However, for some reason, when I submit the form (context is always update) the disabled switch is submitted too and the value false is saved for the field is_activated. Thus the user is not activated anymore.

Request payload:
Image

How can I solve? Thanks.

Steps to replicate

  1. Add a switch field.
  2. Disable it somehow.
  3. Submit.

Workaround

The solution, for now, seems to be to not disable form fields.

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

1 participant