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

Option min/max not working for lists #4733

Closed
leevuli opened this issue Dec 16, 2020 · 4 comments
Closed

Option min/max not working for lists #4733

leevuli opened this issue Dec 16, 2020 · 4 comments
Labels
status: stale type: bug code to address defects in shipped code

Comments

@leevuli
Copy link

leevuli commented Dec 16, 2020

Describe the bug
min/max not working for lists

To Reproduce
Apply the configuration below or just a configuration with the the collection I described.

Expected behavior
Publishing should not be allowed if the list has more or less objects than the min/max.

Applicable Versions:

  • Netlify CMS version: netlify-cms-app 2.12.19, netlify-cms-core 2.30.3
  • Git provider: GitLab
  • OS: Ubuntu 20.04
  • Browser version: Chrome Version 87.0.4280.88 (Official Build) (64-bit)

CMS configuration

backend:
  name: gitlab
  repo: webtmk/tite-website
  branch: publications
  auth_type: implicit
  app_id: not_telling_you
  api_root: https://git.tite.fi/api/v4
  base_url: https://git.tite.fi
  auth_endpoint: oauth/authorize

media_folder: static/assets
public_folder: /assets

extension: md

collections:
  - name: tests
    label: Tests
    folder: _content/tests
    create: true
    slug: "{{slug}}"
    fields:
      - name: bugs
        label: Bugs
        widget: list
        types:
          - label: 'a'
            name: 'a'
            widget: 'object'
            fields:
              - {label: a, name: a, widget: string, }

          - label: 'b'
            name: 'b'
            widget: 'object'
            fields:
              - {label: b, name: b, widget: string }

          - label: 'c'
            name: 'c'
            widget: 'object'
            fields:
              - {label: c, name: c, widget: string }
              - label: Options (FI)
                name: options_fi
                widget: list
                min: 2
                field: { label: Option, name: option, widget: string }
                summary: "{{fields.option}}"

        summary: '{{fields.a}}'
        min: 1
        max: 2

Additional context
Not sure if the problem is only applicabble to this specific configuration or if it applies to lists in general.

@leevuli leevuli added the type: bug code to address defects in shipped code label Dec 16, 2020
@aaron3238
Copy link

aaron3238 commented Dec 2, 2022

@koxanybak I was having the same issue you described. It looks like both min and max are required. I was just trying to specify a minimum of 1 and it did not work. With both min and max set, the feature works fine. The documentation for min and max appears to be lacking. Min and max should each be able to be used exclusively as well.

@alihardan
Copy link

@aaron3238 Thanks you saved my day

@stale
Copy link

stale bot commented Apr 26, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the status: stale label Apr 26, 2023
@martinjagodic
Copy link
Member

Closing as answered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: stale type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

4 participants