verbb / formie

The most user-friendly forms plugin for Craft CMS.
Other
95 stars 73 forks source link

Multipage form not saving submissions? (formie 1.3.21) #372

Closed lexislav closed 3 years ago

lexislav commented 3 years ago

Description It seems, that multipage forms are not saving submissions. All form process seems right and submission seems to be completed – but no record visible in CP.

Form settings

Additional info

engram-design commented 3 years ago

Just wanted to confirm you're looking at incomplete submissions using the status dropdown? image

lexislav commented 3 years ago

They are in the incomplete list - but why not in all/completed as the form was submitted? I should mentioned that.

edit: {% set submitted = craft.formie.plugin.service.getFlash(pageForm.id, 'submitted') %} is true (at least)

engram-design commented 3 years ago

Ah, I see, so the submission has been saved as incomplete, but not complete when you reach the final page and submit on that final page.

Do you have any captchas configured? Or anything in the storage/logs/formie.log file?

lexislav commented 3 years ago

I have a few forms on the same site, all working. Just the multipaged-one does not. And even that form was working while ago.

I have captchas enabled, including reCaptcha (on all forms). Coonsole in browser show this statement: [Log] Unable to find ReCAPTCHA placeholder for #formie-form-182982603dff9fbda58 (recaptcha-v3.js, line 1) This log is not shown on other Formie form (singlepage) with reCaptha enabled (just tested). edit: reCaptcha is set to v3, not enabled on the all form pages.

There are Errors shown on Tools/Queue manager:

Sending form notification.
ID: 577834
Status: Error
Error:  Argument 2 passed to verbb\formie\services\Emails::sendEmail() must be an instance of verbb\formie\elements\Submission, null given, called in /var/www/clients/client1/web9/vendor/verbb/formie/src/services/Submissions.php on line 156
Progress    0%
Time:   300 sekundy
Priority    1024
Pushed at   1. 3. 2021 22:05:46
Updated at  1. 3. 2021 22:11:19
Failed at   1. 3. 2021 22:11:19

And finally this is from Formie log:

$_POST = [
    'CRAFT_CSRF_TOKEN' => '••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••'
    'action' => 'formie/submissions/submit'
    'handle' => 'anfrageKa'
    'siteId' => '3'
    'pageIndex' => ''
    'fields' => [
        'produkt' => 'Rastzimmer für die Fahrer des öffentlichen Personenverkehrs in Brünn'
        'vorname' => [
            'firstName' => ''
            'lastName' => 'test12'
        ]
        'firma' => 'test12@test12.cz'
        'privat' => ''
        'eMail' => 'test12@test12.cz'
        'ihreNachricht' => 'test12'
    ]
    '__DUP_1829825454' => '603d90969e8d4'
    'beesknees' => ''
    '__JSCHK_1829825454' => '603d90969e8f2'
]
2021-03-02 02:12:31 [-][-][-][info][formie] Submission triggered for anfrageKa.
2021-03-02 02:12:31 [-][-][-][info][formie] Submission marked as spam - “Failed Captcha “Recaptcha”: “”” - {"produkt":"Rastzimmer für die Fahrer des öffentlichen Personenverkehrs in Brünn","vorname":"{\"prefix\":null,\"firstName\":\"\",\"middleName\":null,\"lastName\":\"test12\",\"name\":null,\"isMultiple\":true}","firma":"test12@test12.cz","eMail":"test12@test12.cz","ihreNachricht":"test12","agree":true}.
2021-03-02 02:12:31 [-][-][-][info][application] $_GET = [
    'p' => 'direkte-anfrage'
    'product' => 'Rastzimmer für die Fahrer des öffentlichen Personenverkehrs in Brünn'
]

$_POST = [
    'CRAFT_CSRF_TOKEN' => '••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••'
    'action' => 'formie/submissions/submit'
    'handle' => 'anfrageKa'
    'siteId' => '3'
    'pageIndex' => '1'
    'submissionId' => '228613'
    'redirect' => '00c75f5f4be0f1fbb9aca09479e5e8bc4d3057ca257feeaa3355f816ee932e7ddirekte-anfrage?form=danke'
    'fields' => [
        'bauort' => ''
        'geplanteFertigstellung' => ''
        'geplanteNutzung' => ''
        'agree' => '1'
    ]
    '__DUP_1829825455' => '603d90fb7fa5f'
    'beesknees' => ''
    '__JSCHK_1829825455' => '603d90fb7fab3'
]

Thanks for any idea how to fix this.

engram-design commented 3 years ago

Looks like at least that submission in your logs is being marked as spam with reCAPTCHA. The warning in your console is normal for multi-page forms, in that the placeholder is normally hidden on the last page, which is hidden.

I might recommend turning off all captchas other than reCAPTCHA, as there might be some interference. But even when marked as spam, it should be completing the submission anyway...

lexislav commented 3 years ago

I have turned all the protection off and on in different setups. The problem is related only to reCaptcha indeed. If marked as spam, it should end with Spam tag/status - but is not. And the same reCaptcha works on the same site for Contact form and other single page forms with no issues.

    1. 2021 v 11:18, Josh Crawford notifications@github.com:

Looks like at least that submission in your logs is being marked as spam with reCAPTCHA. The warning in your console is normal for multi-page forms, in that the placeholder is normally hidden on the last page, which is hidden.

I might recommend turning off all captchas other than reCAPTCHA, as there might be some interference. But even when marked as spam, it should be completing the submission anyway...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/verbb/formie/issues/372#issuecomment-788795822, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABWQ6VKAYLVQH7K4CIEL7O3TBS3P5ANCNFSM4YNWO7VQ.

engram-design commented 3 years ago

Can you confirm if you have the "Save Spam Submissions" plugin setting enabled? It's enabled by default on recent releases, but for older releases this was off by default.

If the submission is marked as spam, it won't be saved to the database. For multi-page forms, while the submission will exist an an incomplete form, it won't be saved as a spam submission. It'll still exist as an incomplete form.

lexislav commented 3 years ago

Save Spam Submissions was off. When turned on (as well as reCaptcha for testing). Forms are saved marked with Spam status.

I have turned off the reCaptcha to make the form work.

    1. 2021 v 3:00, Josh Crawford notifications@github.com:

Can you confirm if you have the "Save Spam Submissions" plugin setting enabled? It's enabled by default on recent releases, but for older releases this was off by default.

If the submission is marked as spam, it won't be saved to the database. For multi-page forms, while the submission will exist an an incomplete form, it won't be saved as a spam submission. It'll still exist as an incomplete form.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/verbb/formie/issues/372#issuecomment-789366478, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABWQ6VPICGF3SWSIXXTRECLTBWJ4BANCNFSM4YNWO7VQ.

engram-design commented 3 years ago

So it sounds like reCaptcha is flagging items as spam, when it shouldn't. This is probably the first time I've heard of this, but I'll look into it further. I don't believe we get a "why" back from reCaptcha about why something was flagged as spam, so it makes it difficult to know why it's been marked.

lexislav commented 3 years ago

Yes, that’s how it looks. Strange is that it flags like a spam only on the multipage form. At least in my case. The domain and reCaptcha account are the same.

    1. 2021 v 12:38, Josh Crawford notifications@github.com:

So it sounds like reCaptcha is flagging items as spam, when it shouldn't. This is probably the first time I've heard of this, but I'll look into it further. I don't believe we get a "why" back from reCaptcha about why something was flagged as spam, so it makes it difficult to know why it's been marked.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/verbb/formie/issues/372#issuecomment-789652103, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABWQ6VOEAPZSCVXAEZQE2RTTBYNSNANCNFSM4YNWO7VQ.

engram-design commented 3 years ago

Strange indeed. I definitely can't replicate it with a number of multi-page forms I have myself, so need to investigate further.

lexislav commented 3 years ago

I did some further testing and the problem is not with default Formie template, but with my custom template only. Sorry for that.

I did some debugging and it is related to this part of my page.html template:

<div {{ attr(attributes) }}> {% set html %} {% hook 'formie.page.start' %}

…
…
{% if form.pages|length == 1 %}
{{ formieInclude('_includes/submit') }}
{% endif %}

{% if form.pages|length > 1 %} {{ formieInclude('_includes/submit') }} {% endif %}

On multipage forms, submit buttons are moved out of containing div fui-form-container It is because of form design. The html result like this:

<form…> <div class="fui-form-container“> <div class="fui-tabs“>…

<div id="formie-form-182982603f90dc8e910-p-5470" class="fui-page " data-index="0" data-id="5470“>… …some hidden fields, honeypots I guess… <div class="fui-btn-container fui-btn-center“> and submit is moved here

Only mystery now is, how the form could work at the time the formie was addopted for the site.

    1. 2021 v 12:46, Josh Crawford notifications@github.com:

Strange indeed. I definitely can't replicate it with a number of multi-page forms I have myself, so need to investigate further.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/verbb/formie/issues/372#issuecomment-789656533, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABWQ6VJ7QCWDNPWRLTJPMUDTBYOQVANCNFSM4YNWO7VQ.

engram-design commented 3 years ago

Ah, good find. I actually came across this myself at the same time, and should be fixed in https://github.com/verbb/formie/commit/be0f73daae96d366f7da7c7c457f2f2f41198a62 as the captchas were relying on the page wrapping element, which shouldn't be the case, especially for custom forms.

lexislav commented 3 years ago

Perfect! Looking forward the next update.

jsunsawyer commented 3 years ago

@engram-design This is currently affecting/breaking a simple, custom newsletter signup form on our site. (No actual newsletter service yet, just collecting emails.)

Is there a dev branch or something so I can get a fix out?

engram-design commented 3 years ago

I should have a new release out shortly, but you can get this early by changing your verbb/formie requirement in composer.json to:

"require": {
  "verbb/formie": "dev-craft-3 as 1.3.21",
  "...": "..."
}

Then run composer update.

jsunsawyer commented 3 years ago

Thanks. I already went ahead and disabled reCaptcha to temporarily fix this, so I'll just wait for the new release.

engram-design commented 3 years ago

Should be fixed in 1.3.22