我一直在查看这些文档https://learn.getgrav.org/forms/forms#multiple-forms现在已经有一天了,但仍然无法看到我做错了什么。它填充的问题形式,但只有第一个列在这里:
forms:
sign-up-form:
title: Bolig i ....?
fields:
- name: navn
label: navn
placeholder: Navn
autofocus: off
autocomplete: off
type: text
validate:
required: true
- name: email
label: email
placeholder: Email
autofocus: off
autocomplete: off
type: text
validate:
required: true
buttons:
- type: submit
value: Skriv mig op
classes: "button white"
process:
- email:
from: "{{ config.plugins.email.from }}"
to:
- "{{ config.plugins.email.from }}"
- "{{ form.value.email }}"
subject: "[Feedback] {{ form.value.name|e }}"
body: "{% include 'forms/sign-up-form/data.html.twig' %}"
- save:
fileprefix: feedback-
dateformat: Ymd-His-u
extension: txt
body: "{% include 'forms/data.txt.twig' %}"
- message: Tak for din henvendelse, vi vender tilbage
footer-form:
title: Interesseret i ....?
fields:
- name: navn
label: navn
placeholder: Navn
autofocus: off
autocomplete: off
type: text
validate:
required: true
- name: email
label: email
placeholder: Email
autofocus: off
autocomplete: off
type: text
validate:
required: true
- name: phone
label: phone
placeholder: Telefon
autofocus: off
autocomplete: off
type: text
validate:
required: true
buttons:
- type: submit
value: Ja tak kontakt mig
classes: "button white"
process:
- email:
from: "{{ config.plugins.email.from }}"
to:
- "{{ config.plugins.email.from }}"
- "{{ form.value.email }}"
subject: "[Interesse I ....] {{ form.value.name|e }}"
body: "{% include 'forms/footer-form/data.html.twig' %}"
- save:
fileprefix: feedback-
dateformat: Ymd-His-u
extension: txt
body: "{% include 'forms/data.txt.twig' %}"
- message: Tak for din henvendelse, vi vender tilbage
我在我的default.md
中列出了两个表单配置,然后它完美呈现页面,但我渲染表单的两个地方我用以下方式呈现它们:
{% include 'forms/sign-up-form/form.html.twig' with { form: forms('sign-up-form') } %}
{% include 'forms/footer-form/form.html.twig' with { form: forms('footer-form') } %}
我没有想法,现在我只是在这里找不到任何解决方案,我希望有人可以帮助我。
答案 0 :(得分:0)
我认为您唯一的问题是您没有包含正确的模板。 包含表单是通过包含forms / form.html.twig来完成的,form / form.html.twig是表单插件提供的模板。您可以在user / plugins / form / templates中找到此模板。 此模板将获取表单定义并显示字段。所以改变你的包括:
title
应该有用。
希望它有所帮助!