I can hide the button with css but the back button from the browser still moves me back to the previous page.
Is it possible to make a checkbox that disable the preview functionality for the wizard pages?

Comments

KevinvdBurg created an issue. See original summary.

KevinvdBurg’s picture

Issue summary: View changes

small edit

jrockowitz’s picture

Please see: http://stackoverflow.com/questions/19926641/how-to-disable-back-button-i...

The YAML Form module now includes the ability to inject custom CSS/JS into a form so you could test out a few possible solutions.

If you found a cross-browser way to stop a user from navigating back using the browser's back button that would be amazing.

This would also solve #2826522: Browser back button is causing form wizard to lose its current page and all submitted data.

jrockowitz’s picture

The below code snippet from http://stackoverflow.com/questions/17962130/restrict-user-to-refresh-and... actually worked in Chrome.

history.pushState({ page: 1 }, "Title 1", "#no-back");
window.onhashchange = function (event) {
  window.location.hash = "no-back";
};
jrockowitz’s picture

This seems like even a simpler solution and make reasonable arguments why one would disable the back button.

The most common problems an application designer should consider are as follows:

  • Resubmission of web form data, which might create duplicate entries.
  • Issues with workflow of the application.
  • Compromised application security.

--- http://www.codeproject.com/Tips/632336/Disabling-browsers-back-button

KevinvdBurg’s picture

Thx jrockowitz, I think I got it.

I used a combination using this:

history.pushState({ page: 1 }, "Title 1", "#no-back");
window.onhashchange = function (event) {
  window.location.hash = "no-back";
};

and this: http://stackoverflow.com/questions/28028297/js-window-history-delete-a-state

Resulting in that you can't use the back button on the active form. (Tested on Chrome, Firefox and Safari).
It would be nice if this is still a feature in YAML Form because I can't imagine that I'm the only one that whats this for there wizard pages.

jrockowitz’s picture

Yes, I am going to add this feature.

  • jrockowitz committed 7b50bc8 on 2828138-previous
    Issue #2828138: Disable the previous functionality for a wizard page.
    

  • jrockowitz committed c1e9aa0 on 2828138-previous
    Issue #2828138: Disable the previous functionality for a wizard page....
jrockowitz’s picture

Status: Active » Needs review
StatusFileSize
new83.46 KB

  • jrockowitz committed a4133ef on 2828138-previous
    Issue #2828138: Disable the previous functionality for a wizard page....

  • jrockowitz committed 793a580 on 8.x-1.x
    Issue #2828138 by jrockowitz, KevinvdBurg: Disable the previous...
jrockowitz’s picture

Status: Needs review » Fixed

Please download or checkout the latest dev release to review.

KevinvdBurg’s picture

StatusFileSize
new348.67 KB

Thanks for the patch :D

I downloaded the latest version of the dev branch and tested it.

I'm getting this error when i'm creating a new Form and edited an existing one:
The issue

Pastebin

jrockowitz’s picture

You probably need to run the pending database updates.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.