Closed anton-mellit closed 4 years ago
Im not sure I understand the question, do you have any screenshots of what's happening?
Sorry, let me explain. In config/plugins/login.yaml
I have
user_registration:
enabled: true
fields:
- username
- password
- email
- fullname
- timezone
- digest_allowed
I have a profile page pages/12.profile/profile.md
with
form:
fields:
avatar_img:
type: avatar
username:
type: text
readonly: true
disabled: true
fullname:
type: text
validate:
required: true
email:
type: email
placeholder: "Enter your email"
validate:
required: true
message: PLUGIN_LOGIN.EMAIL_VALIDATION_MESSAGE
timezone:
name: timezone
label: 'Time zone'
placeholder: 'Select time zone'
type: select-timezone
set_from_browser: true
validate:
required: true
digest_allowed:
label: 'Subscribe to the weekly digest'
type: checkbox
Now when the user ticks the "Subscribe to the weekly digest" checkbox, submits the form, the value digest_allowed: '1'
is stored in his accounts/{username}.yaml
file. But when the user unticks this checkbox, nothing is done, the value in accounts/{username}.yaml
remains digest_allowed: '1'
.
Expected behavior: the value should change to digest_allowed: '0'
or digest_allowed: null
or digest_allowed: false
try adding to the checkbox
validate:
type: bool
Thank you, that did it!
I created a user field associated with input of type checkbox on the "login" form and the "profile" form.
If I uncheck the checkbox on the profile form, the new value it is not saved in the data file.