Using forms in modular pages
If your theme does not provide a templates/forms/form.html.twig file, it's not set up to use forms, but no fear - just copy the form templates from Antimatter, the defa...
I’m trying to create a form by just test, but apparently it doesn’t read the form in the edit box
And I’ve paste already the form.html.twig and formdata.html.twig
The address is fine?
I grabbed them in user/plugins/form/templates, because there was nothing in system/templates
You have to put form definition into page’s frontmatter (header) , not into content itself. You have select “advanced editor”, or edit the file manually.
@MakaryGo , Did you perhaps mean:
In Admin panel
Select ‘Expert’ mode
Select ‘Content’ tab
Edit frontmatter/header in field ‘Frontmatter’
Precisely. On the above screen it was clearly in the content block itself.
Not showing yet, cache in Edge and Admin erased
Modular preview:
@Yourdead , As you have, I have followed the documentation on How to: Forms in modular pages .
Using fresh Grav 1.6.26 installation using theme Quark.
I have the following folder structure:
pages
├── 01.home
│ └── default.md
├── 02.typography
│ └── default.md
└── 03.modular1
├── _module1
│ └── text.md
├── _module2
│ └── form.md
└── modular.md
Page ‘/03.modular1/modular.md’ contains:
---
title: Modular1
content:
items: '@self.modular'
---
Page ‘/03.modular1/_module2/form.md’ contains:
---
title: Module 2
cache_enable: false
form:
action: /modular1 <-- Use route to modular, else 'Thank you' will break
name: my-nice-form
fields:
- name: name
label: Name
placeholder: 'Enter your name'
autofocus: 'on'
autocomplete: 'on'
type: text
default: test
buttons:
- type: submit
value: Submit
process:
- message: 'Thank you for your feedback!'
---
# Module 2
I made no other changes and did not copy any files.
The form is now correctly shown in module ‘/03.modular1/_module2/form.md’