silverstripe / silverstripe-userforms

UserForms module provides a visual form builder for the Silverstripe CMS. No coding required to build forms such as contact pages.
BSD 3-Clause "New" or "Revised" License
135 stars 225 forks source link

Submitting a form asks user to leave the page #868

Closed guyvanbael closed 4 years ago

guyvanbael commented 5 years ago

Update

It looks like this has regressed. Versions affected:

CMS 4.6.2 and userforms 5.6.1

Old description

just tested the new 5.3.1 release. Submitting a form causes page to ask if you want to leave the page (screenshot). (silverstripe version 4.3.3). If you choose to leave the page, the form is submitted and thank you message is shown.

Schermafbeelding 2019-03-21 om 13 44 03
robbieaverill commented 5 years ago

@guyvanbael which core version are you using? Also do you have any console errors when this happens?

NightJar commented 5 years ago

OP was updated:

Unfortunately I cannot reproduce.

Steps I have taken:

Project was: cwp/cwp-recipe-kitchen-sink silverstripe/framework 4.3.x-dev 075716f silverstripe/userforms 5.3.x-dev 21813ef app/_config.php modification: i18n::set_locale('de_DE');

Browser:

Vivaldi | 2.3.1440.61 (Stable channel) (32-bit)
-- | --
Revision | 2280481e163fe1c769ad046b453248ddb5bd477e-refs/heads/master@{#629885}
OS | Windows
JavaScript | V8 7.2.502.28

@guyvanbael can you please provide some detailed steps to reproduce?

I noticed in #864 that the cause appears to be custom modification of the bundled javascript files (inclusion into a custom bundle) so I cannot be sure this is a problem with the module code.

@purplespider could you please also perhaps provide more details as you are also experiencing this issue.

@extravio are you able to reproduce this outside on a "base install" (outside of custom build modifications)?

It is also worth noting that are you sure is entirely applied via a third party jQuery plugin. If there is an issue with this functionality, I imagine there is an issue with that plugin. This commit is the only execution significant update since the version bundled with UserForms - perhaps manually applying this patch then testing might see it solved... if you try this please report back.

As this cannot be replicated I'm afraid I'll close this for now. If someone would like to provide more information to step the investigation forward then I'm happy to reopen :)

guyvanbael commented 5 years ago

@robbieaverill This is in my composer.json "silverstripe/recipe-plugin": "^1.2", "silverstripe/recipe-cms": "4.3.3@stable", "silverstripe-themes/simple": "~3.2.0", "silverstripe/userforms": "5.3.1"

In the console, i'm getting this: userforms.js?m=1547826173:1 Uncaught TypeError: Cannot read property 'data' of undefined at a.validator.submitHandler (userforms.js?m=1547826173:1) at d (jquery.validate.min.js?m=1547826173:4) at HTMLFormElement. (jquery.validate.min.js?m=1547826173:4) at HTMLFormElement.dispatch (jquery-3.3.1.min.js:2) at HTMLFormElement.y.handle (jquery-3.3.1.min.js:2) submitHandler @ userforms.js?m=1547826173:1 d @ jquery.validate.min.js?m=1547826173:4 (anonymous) @ jquery.validate.min.js?m=1547826173:4 dispatch @ jquery-3.3.1.min.js:2 y.handle @ jquery-3.3.1.min.js:2

guyvanbael commented 5 years ago

@robbieaverill setting SilverStripe\UserForms\Model\UserDefinedForm: enable_are_you_sure: false fixes the problem, but as stated in #864 , it shouldn't popup at all imho.

NightJar commented 5 years ago

Thanks for the extra information @guyvanbael - however as I cannot reproduce this, would you mind please checking out https://github.com/creative-commoners/silverstripe-userforms/tree/pulls/5.3/submit-no-errors and testing this fix for me?

This should be easily achievable through composer (apologies if you are familiar with how to do this already):

...
"repositories" [
    {
        "type": "vcs",
        "url": "https://github.com/creative-commoners/silverstripe-userforms"
    }
],
...
"require": {
    ...
    "silverstripe/userforms": "dev-pulls/5.3/submit-no-errors as 5.3.1",
    ...
},
...
ohararyan commented 5 years ago

@NightJar I've just come across the same issue using the following.

        "cwp/cwp-recipe-core": "2.2.2@stable",
        "cwp/cwp-recipe-cms": "2.2.2@stable",
        "silverstripe/recipe-form-building": "1.2.3@stable",
        "silverstripe/spamprotection": "^3.0",
        "silverstripe/recaptcha": "dev-master"

Checking out your branch however fixes the issue.

NightJar commented 5 years ago

Thanks for reporting back @ohararyan - without this kind of community involvement we'd not be able to merge :)

Closing now as multiple people have reported the branch solves the issue, and it has been merged :D

guyvanbael commented 4 years ago

This is still showing up on ss4.6.0 and userforms 5.6.0

rsmclaren commented 4 years ago

Also experiencing this issue on ss4.6.2 and userforms 5.6.1

emteknetnz commented 4 years ago

Original fix https://github.com/silverstripe/silverstripe-userforms/pull/869

Code fix is still there in 5 and 5.6 and 5.6.1, so it's probably a different thing causing this https://github.com/silverstripe/silverstripe-userforms/blob/5/client/src/bundles/UserForms.js#L516 https://github.com/silverstripe/silverstripe-userforms/blob/5.6/client/src/bundles/UserForms.js#L516 https://github.com/silverstripe/silverstripe-userforms/blob/caeef2fc481aa3aed84f62b73d61a1dcbe4e0ed1/client/src/bundles/UserForms.js#L516

emteknetnz commented 4 years ago

Fixed in https://github.com/silverstripe/silverstripe-userforms/pull/1000

Cheddam commented 4 years ago

1000 has been merged and released as 5.6.2. Please let us know if this issue persists after updating.

NightJar commented 4 years ago

Related: #999 (prompting fix #1000)