Force Javascript to cancel field registration with required (HTML 5)?

Asked

Viewed 345 times

6

I have a registration field that are required to be completed via HTML5. However, by clicking the unsubscribe button, HTML5 does not let Javascript return to the previous page! = ( Requires me to fill in that required field.

How to proceed?

'click button#back': function (evt) {
            evt.stopImmediatePropagation();
            Backbone.history.navigate("/InstanciaManager", {trigger : true});
        }, 
  • Welcome to Stackoverflow! You can use something with localStorage or sessionStorage to do this. See Webstorage

  • 1

    Post the HTML code. Maybe you have not set the button as [type=button]. This can cause problems as some browsers may identify that you are trying to make a Submit with the button that did not specify the type. Own experience :)

  • Thanks mutlei and Wallace, it worked! =)

  • What worked?

  • The type of the button and change the order in JS! Also, there was another problem p work.. hahaha Thanks, guys

1 answer

1

When you do the evt.stopImmediatePropagation() you prevent the event that was shot from continuing to run, that is, you prevent the return to the previous page.

Reverse the order of commands, thus:

'click button#back': function (evt) {
        Backbone.history.navigate("/InstanciaManager", {trigger : true});
        evt.stopImmediatePropagation();
    }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.