#Custom form fields

7 messages · Page 1 of 1 (latest)

regal chasm
#

Guys I can't seem to figure it out. I created a custom form checkbox field and I can't save it do DB, it only saves blockType somehow. Weird thing is it works on local but not in production. Here is the output from API:

"title": "Kontakt",
"fields": [
{
"blockType": "multiple-checkbox"
},
{
"name": "text",
"label": "Text Input",
"required": true,
"id": "650809c27c5f1eb8b1fa2ba9",
"blockType": "text"
}
],```

and here is my custom input code:

```import { DefaultFieldProps } from "./default-field-props";
import { FieldRequired } from "./options";
import { Block } from "payload/types";

export const MultipleCheckbox: Block = {
  slug: "multiple-checkbox",
  interfaceName: "MultipleCheckboxField",
  labels: {
    singular: "Pole wyboru",
    plural: "Pola wyboru",
  },
  fields: [
    {
      type: "row",
      fields: [
        ...DefaultFieldProps,
        {
          name: "options",
          label: "Opcje",
          labels: {
            singular: "Opcja",
            plural: "Opcje",
          },
          type: "array",
          fields: [
            {
              name: "option",
              label: "Opcja",
              type: "text",
            },
          ],
        },
      ],
    },
    FieldRequired,
  ],
};

lyric dockBOT
small torrent
#

Weird thing, locally it is visible under /dist/fields/forms but at production it isn't building it.

small torrent
#

Fixed, unrelated with Payload. It was a wrong tsconfig.json configuration which messed with build. We needed to delete dist and build folders at production, then we saw errors.

surreal wigeon
#

Hey @small torrent glad you got this sorted out! We're around if you need anything else.

lyric dockBOT
#

You do not have permission to mark this thread as solved. Only thread creators, contributors and payload team members can mark a thread as solved.

small torrent