getgrav / getgrav/grav-plugin-form

Field with option toggleable can not be set to disabled again

Open
#430 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
64
Forks
80
Avg merge
10h 13m
Merged PRs (30d)
9

Description

I have added the `toggleable` option to a pages select field in a plugin blueprints file.
When the config file does not yet contain the `custom_dialog_forms_page` variable the form shows the checkbox and the pages select field all disabled.

When I check the checkbox the field becomes enabled and I'm able to select a page. The selected page does correctly get saved as the value of the `custom_dialog_forms_page` variable in the config file.

Another click on the now enabled checkbox does disable the field. However, once the form gets saved and the page reloads the checkbox is automatically checked again and the field shows as enabled. Also the entry in the config file does not get removed when the toggleable checkbox state in unchecked. Which explains why the checkbox gets checked upon a page reload?

```
custom_dialog_forms_page:
type: pages
toggleable: true
size: medium
classes: fancy
label: Select page
show_all: false
show_modular: false
show_root: false
default: ''
```

I was hoping that by using the toggleable option I could come to the situation where no page is selected at all. The pages select field does not provide a "blank" or "none" value to select.

Am I using the option in the wrong way perhaps?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the issue with the provided pages field blueprint, checking the form's save and reload behavior after selecting a page and unchecking the toggle. Trace the toggleable field handling and configuration persistence; done means unchecking removes the custom_dialog_forms_page value and the field remains disabled with no page selected after reload.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.