getgrav / getgrav/grav-plugin-form

Form does not work when defined in pages that redirects

Open
#462 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
64
Forks
80
Avg merge
10h 13m
Merged PRs (30d)
9

Description

I know this is an edge usecase:
```
/map
/restaurants -> /map (redirect)
/restaurants/pizza
/restaurants/hamburger
```

I want to define **one global form** that gets reused in every subpage using:
```
{% include "forms/form.html.twig" with { form: forms('restaurant_contact') } %}
```

I've set `action` to `#contact`, so the form redirects to the page itself rather than the page where the form got defined. This all works well unless the page where the form is defined redirects to another page using `redirect: '/map[307]'`. The browser shown a redirection error. Not sure if this is intended, but I need to place the form to any other page now.

Is there a way to define a form in twig maybe, or at least in some yaml file that gets loaded instead of adding the form to a page?

Contributor guide

No contributing guide indexed for this repository

Research direction

No source file or test is named in the issue. Start by tracing how forms/form.html.twig resolves forms and how the page redirect configuration is handled; the work is done when a form defined for a redirecting page can be reused on another page without a browser redirection error.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.