8000 Stripe Ship Back Button Throws Invalid Entries · Issue #62 · bleroy/Nwazet.Commerce · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Stripe Ship Back Button Throws Invalid Entries #62

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

Open
bleroy opened this issue Nov 18, 2014 · 3 comments
Open

Stripe Ship Back Button Throws Invalid Entries #62

bleroy opened this issue Nov 18, 2014 · 3 comments

Comments

@bleroy
Copy link
Owner
bleroy commented Nov 18, 2014

Originally reported by: Jeffrey Olmstead (Bitbucket: ems, GitHub: ems)


When the Stripe Back button is pressed it throws invalid errors due if you don't have the form filled in. Of course, we don't want client side form validation being done on the Back button being pressed as we are not saving the data anyway. Will try to get a fix but listing this here for anyone else who might run into the issue.


@bleroy
Copy link
Owner Author
bleroy commented Nov 18, 2014

Original comment by Jeffrey Olmstead (Bitbucket: ems, GitHub: ems):


My "simple" fix was to add in a javascript variable:

#!javascript
var BackButtonClicked = false;

Then I added in an event handler for the back button click event:

#!javascript
    backButton.click(function (e) {
        BackButtonClicked = true;
    });

Then on the form submit event I just check to ensure it wasn't the back button that was clicked:

#!javascript
        if (!BackButtonClicked) {
            var validated = true,
            .........

and that works out great. See anything that could go wrong with that?

@bleroy
Copy link
Owner Author
bleroy commented Nov 18, 2014

Original comment by Josh Berry (Bitbucket: joshberry, GitHub: joshberry):


I don't see anything wrong with it. However, it might be a little more standard if you use the formnovalidate attribute on the back button and check for that on the submit event. This way if someone wants to swap out their own client-side validation framework or let the browser do it's thing it will more than likely "just work".

@bleroy
Copy link
Owner Author
bleroy commented Nov 18, 2014

Original comment by Jeffrey Olmstead (Bitbucket: ems, GitHub: ems):


I thought about trying to access the button clicked but I couldn't find anywhere in jQuery that allows you to get this access. You can, of course, use it if you do the validation on the actual button clicked but it is best to do the form validation on the form submission. This is why I did the little hack of manually recording which button was clicked. I would love to learn about the form no validate approach as it would be cleaner. Thanks for letting me know.

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

1 participant
0