Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Radio Button - If validation is required, javascript popup shows "Do you want to leave this site?... #532

Closed
Codesesh opened this issue Dec 11, 2016 · 4 comments

Comments

@Codesesh
Copy link

Have recently discovered that if the "If this field Required?" is checked on a radio button group, when you click to submit the form, a javascript popup displays as per below:

Do you want to leave this site?
Changes that you made may not be saved.

image

If 'leave' is clicked, the form processes as normal, if 'stay' is clicked then nothing happens (as expected).

Obviously this isn't great usability wise. I have only tested this with the radio button. If you just have say all textboxes that are required, this does not happen.

Anyway of removing this popup?

@tractorcow
Copy link
Contributor

You can disable with this code

Config::inst()->remove('UserDefinedForm', 'enable_are_you_sure');

@tractorcow
Copy link
Contributor

tractorcow commented Dec 11, 2016

Sorry, the bug still exists, I should not close it. :)

Possibly a bug in the third party module we are pulling in https://github.com/codedance/jquery.AreYouSure/issues.

Maybe we need something like codedance/jquery.AreYouSure#109 for this module?

@westonganger
Copy link

This issue is actually related to validation, page update and the re-submit. This is because you are replacing the form element in your code, jquery are you sure still thinks its tracking the form but the assigned events are lost.

You must add code similar to the following to fix this issue.

$(document).ajaxComplete(function(){

  $("form").submit(function(){
    $(this).removeClass('dirty');
  });

});

@NightJar
Copy link
Contributor

NightJar commented Apr 8, 2019

Please see fix made in #869 to fix #868 that seems like a duplicate of this issue.

The above looks like a valid work around, for SilverStripe 3 versions of Userforms however.

Closing a SilverStripe 3 issue

Unfortunately, SilverStripe 3 has entered limited support in June 2018. This means we'll only be fixing critical bugs and security issues for SilverStripe 3 going forward.

You can read the SilverStripe Roadmap for more information on our support commitments.

@NightJar NightJar closed this as completed Apr 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants