Skip to content

Error: Unable to use Multiple Instances of svgUploadPreview in single document #12

@avcohen

Description

@avcohen

I'm attempting to use this type multiple times in a single document.

eg:

    ...,
    {
      name: "svgTop",
      title: "Top Image",
      type: "svgUploadPreview",
      description: "Used on the index page - displayed at the top",
      validation: (Rule) => Rule.required(),
    },
    {
      name: "svgBottom",
      title: "Bottom Image",
      type: "svgUploadPreview",
      description: "Used on the index page - displayed at the bottom",
      validation: (Rule) => Rule.required(),
    },
    {
      name: "svgCombined",
      title: "Combined Image",
      type: "svgUploadPreview",
      description: "Used as the header on non-index pages and within the menu.",
      validation: (Rule) => Rule.required(),
    },
    ...

It seems this causes an issue as all inputs have the same HTML name / id attribute svg-upload.

I'd be happy to open a PR but it seems like the easy fix might be replace svg-upload here with this.props.name and the htmlFor attribute on line 54.

Thanks for your work on this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions