Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Can't empty List form field in plugin

Started by Muut Archive 9 years ago · 2 replies · 475 views
9 years ago

I have built many plugins but today I discover an issue which affects all of my plugins.

If in plugin's configuration form has a List field, I can not empty the list. I can add new item, I can edit item's values, but if I delete all items and save the plugin, the items are still there, they are not removed. At the present time the only solution is modifying the configuration file manually.

Here is an example of my plugin's blueprints (I remove label and help attributes):

YAML
name: MyPlugin
version: 1.0.0
description: Custom plugin
icon: plug
license: MIT

form:
  validation: strict
  fields:
    custom_list:
      type: list
      style: vertical
      fields:
        .something:
          type: textarea 
          rows: 10
        .anotherthing:
          type: textarea
          rows: 5

I am not sure this is my fault or this is a bug. I appreciate any help! Thanks!

9 years ago

I already saw that bug report and added "array: true" but the problem still occurs.

My plugin's default configuration only has the line "enabled: true" because the list is optional, so it doesn't have any default values. I also tried to add an empty value to the default configuration file, like "custom_list: ", but it didn't make any difference. I guess my problem is different to that bug report.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1336 9 years ago
Archive · by Muut Archive, 9 years ago
2 925 9 years ago
Archive · by Muut Archive, 9 years ago
2 4056 9 years ago
Archive · by Muut Archive, 9 years ago
1 2941 9 years ago
Archive · by Muut Archive, 9 years ago
3 1112 9 years ago