Netlify-cms: Using array in valueField of relation widget causes TypeError

Created on 16 Jul 2019  路  8Comments  路  Source: netlify/netlify-cms

Describe the bug
If you use array type for the valueField in the "relation" widget of collection, it shows an error screen when you access to the collection record in the admin dashboard.

To Reproduce
Steps to reproduce the behavior. For example:

  1. In a collection configuration in config.yml, add "relation" widget
  2. For "valueField", use array to set a value.
  3. Publish
  4. When you try to access to the collection for editing, it shows an error screen: Type error: t.split is not a function.

Expected behavior
I am not quite sure.

Screenshots
Screen Shot 2019-07-16 at 19 06 38

Applicable Versions:

  • Netlify CMS version: [2.9.1]
  • Git provider: [GitHub]
  • OS: [MacOS 10.14.5]
  • Browser version [chrome 75]
  • Node.JS version: 12.5.0

CMS configuration

          - label: "Agent"
            name: "agent"
            widget: "relation"
            collection: "agents"
            searchFields: ["agent_name", "direct_phone", "email_address"]
            valueField: ["direct_phone"]
            displayFields: ["agent_name", "direct_phone", "email_address"]
stale

Most helpful comment

Thank you @WJXHenry , @talves
I have opened a PR.

All 8 comments

I believe that the valueField parameter only allows for a single field, so the input wouldn't have to be in an array. Try changing valueField: ["direct_phone"] to simply: valueField: "direct_phone".

Thank you. It works.

I think that it would be nice if someone that has and access to this doc page could kindly add a note on it: https://www.netlifycms.org/docs/widgets/#relation

@shumiyao you can definitely do a PR to improve the docs, that would be awesome!

Where is the branch for the doc?

Master branch does not seem to have the Default widgets section.

The file is here.

Thank you @WJXHenry , @talves
I have opened a PR.

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.

closing as stale

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dur41d picture dur41d  路  3Comments

bkroggel picture bkroggel  路  3Comments

ghost picture ghost  路  3Comments

BerkeleyTrue picture BerkeleyTrue  路  3Comments

TomPichaud picture TomPichaud  路  3Comments