plain-solutions-gmbh / kirby-form-block-suite

This form plugin for Kirby offers you maximum flexibility and usability. It can be used as a block anywhere you needed. This repository replaces the obsolete version 2.0.
Other
38 stars 11 forks source link

Bug: Duplicating a page with a form results in both forms getting triggered on submit #58

Closed purplespider closed 1 month ago

purplespider commented 1 month ago

If you duplicate a page which includes a form block, e.g. to make a slightly different variant of that form, when the original form is submitted, it also seems to trigger the submission through the form on the duplicate page. Resulting in duplicate notification emails, and the submissions appearing in the "Inbox" tab for both forms.

This only appears to occur if the page is duplicated and doesn't occur if a form block or layout is copied to another page.

Steps to reproduce:

  1. Create a new page, add a layout and insert a form block. Save the page.
  2. Duplicate this page.
  3. Visit the original page and submit the form.

What I expect to happen:

What actually happens:

It seems like when you copy a block/layout from one page to another, the block gets a new ID. But if you duplicate a page, the block/layout IDs do not change.

I wonder if you can work around this by checking both the Page URL and Form ID when processing a submission? Or failing that, adding the ability for a user to regenerate the form ID after they copy a block?

plain-solutions-gmbh commented 1 month ago

This could be done with a page-duplicate-hook. But i rather like to bring all forms and requests to one subfolder in the root content folder. The next major release will do this. But i have to wait for the new Kirby Release that may contains a workaround for that.

In the meanwhile you can change the form-id manually.