Hi all.Is it possible to create a form as a module on a page? This form-module will be used across different pages.
It’s possible to use a form in a modular page but not to use it across multiple pages, as of now - it’s something I’d like to add.
In your page Frontmatter
show_form:true
In your Twig template:
{% if page.header.show_form %}
{% include 'partials/form.html.twig' %}
{% endif %}
I have a custom form, I’m not sure how the Grav forms work. This may not apply to you.
@Ryan, it’s different from what we need.
The only option I see now to output the same form on various pages is to have a javascript-based form from one of the services that provide form handling (wufoo, google forms…), and include it in your footer for example.
couldn’t you just use find()
on the modular route and render the content with the template?
With this I built myself a little bit of a Drupal Like Block System for content which is the same over several pages. I don’t know how a form will perform within such an implementation but I think it’s woth a try.
{% set blocks_content = page.find('/foobar') %}
{% if blocks_content.template %}
{% include blocks_content.template ~ '.html.twig' with {'header': blocks_content.header, 'page': blocks_content} %}
{% endif %}
---