Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

[BUG] Extra empty item at select component #140

Open
2 tasks done
weihan1394 opened this issue Jun 23, 2020 · 3 comments
Open
2 tasks done

[BUG] Extra empty item at select component #140

weihan1394 opened this issue Jun 23, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@weihan1394
Copy link

weihan1394 commented Jun 23, 2020

I have recently upgraded the formio to the latest version and I realized this weird behavior at select component. There will always be an empty item above all the specified items as populated from the json. I have attached the behavior for referencing.

Environment

  • Hosting type
    • Form.io
    • Local deployment
  • Formio.js version: ^4.10.3-rc.3
  • angular-material-formio: ^1.19.0
  • Frontend framework: angular 8.2.14
  • Browser: Chrome
  • Browser version: 83.0.4103.106 (Official Build) (64-bit)

Steps to Reproduce

  1. Update the json file as below
  2. When the form is generated, the select component will have an empty item above.

Expected behavior

No empty item above

Observed behavior

Extra empty item above

Example

Json

{
    "components": [
        {
            "type": "select",
            "label": "Single Select",
            "key": "single",
            "placeholder": "Select one",
            "data": {
                "values": [
                    {
                        "value": "apple",
                        "label": "Apple"
                    },
                    {
                        "value": "banana",
                        "label": "Banana"
                    },
                    {
                        "value": "pear",
                        "label": "Pear"
                    },
                    {
                        "value": "orange",
                        "label": "Orange"
                    }
                ]
            },
            "dataSrc": "values",
            "defaultValue": "banana",
            "template": "<span>{{ item.label }}</span>"
        }
    ]
}

screenshot

@weihan1394 weihan1394 added the bug Something isn't working label Jun 23, 2020
@Asifislam110
Copy link

I faced the same need. Could anyone help with implementation? Any advice is welcome

@albert5287
Copy link

I have created a PR to solve this issue #144

@haschu
Copy link

haschu commented Oct 8, 2020

Hey,
just a friendly reminder that a PR with a quick-fix was submitted by @albert5287.
Should be fairly easy to merge, as it doesn't break anything 🙂

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants