我是棱镜的新手,试图弄清楚这是否是我需要的正确工具。我需要创建多个表单模板。我希望棱柱形用户能够构建模板,该模板将被加载到gatsby中,在该模板中,每个字段将根据标题,类型,动作,名称作为组件被构建。
棱柱形似乎是一个很好的候选者,并且没有人知道我如何设置棱柱形端头的任何例子。到目前为止,我所看到的大部分内容都是只有标题和图像的整页。不完全是形式。
在他们的存储库中,我仅看到这些用于创建元素的选项,是否错过了一些重要的选项?
我将如何创建表单元素?是否有创建自定义对象以导出的方法?每次我尝试向json编辑器添加新文件或自定义对象时,都会说。无法识别的属性将被忽略。 我希望能够使用该组将一堆表单元素组合在一起,即使它们只是我可以传递自定义属性的自定义对象,因此当我将组加载到React时,我也可以使用自定义属性进行构建我的组件如果有可能的话,任何人都可以将我直接介绍给我。
谢谢!
答案 0 :(得分:0)
我不能说Prismic是否是完成此特定工作的最佳工具,但我认为您高估了呈现html表单的确切需求。
请考虑以下自定义类型。它实际上仅由标题,结构化文本,可重复区域和选择内容组成。数据的处理完全取决于前端。
{
"Main": {
"uid": {
"type": "UID",
"config": {
"label": "Form UID",
"placeholder": "Form UID"
}
},
"form_title": {
"type": "StructuredText",
"config": {
"single": "heading2",
"label": "Form Title",
"placeholder": "Form Title"
}
},
"action_title": {
"type": "StructuredText",
"config": {
"single": "heading2",
"label": "action title",
"placeholder": "Submit form"
}
},
"form_action_description": {
"type": "StructuredText",
"config": {
"single": "paragraph",
"label": "form action description",
"placeholder": "form action description"
}
},
"success_message": {
"type": "StructuredText",
"config": {
"single": "paragraph",
"label": "success message",
"placeholder": "success message"
}
},
"error_message": {
"type": "StructuredText",
"config": {
"single": "paragraph",
"label": "error message",
"placeholder": "error message"
}
},
"submit_button_text": {
"type": "StructuredText",
"config": {
"single": "paragraph",
"label": "submit button text",
"placeholder": "submit"
}
},
"body": {
"type": "Slices",
"fieldset": "Slice zone",
"config": {
"choices": {
"test": {
"type": "Slice",
"fieldset": "Form Section",
"description": "Section of a form",
"icon": "vertical_align_center",
"display": "list",
"non-repeat": {
"form_section_title": {
"type": "StructuredText",
"config": {
"single": "heading1",
"label": "Form Section title",
"placeholder": "Form Section title"
}
},
"form_section_description": {
"type": "StructuredText",
"config": {
"single": "paragraph",
"label": "Form Section Description",
"placeholder": "Form Section Description"
}
}
},
"repeat": {
"label": {
"type": "StructuredText",
"config": {
"single": "paragraph",
"label": "label",
"placeholder": "label"
}
},
"type": {
"type": "Select",
"config": {
"options": [
"text",
"textarea",
"checkbox",
"radio",
"submit"
],
"default_value": "text",
"label": "type"
}
},
"name": {
"type": "StructuredText",
"config": {
"single": "paragraph",
"label": "name",
"placeholder": "name"
}
}
}
}
}
}
}
}
}