Treehouse: Grow your CSS skills. Land your dream job.

onSubmit Validation is affecting multiple buttons – How to Stop?

  • # June 10, 2011 at 11:36 am

    Hi all,

    I have a form that onSubmit it validates the address. My problem is that it is also affecting my back button so when one hits back it tries to validate the form. Can I just have the back button go back without validating the form? Example below.

    < --Code taken out because of length-->

    # June 10, 2011 at 3:11 pm

    I remember running into this problem awhile back. It seemed the issue was that any input that was type=”image” was always treated as a submit button (or something similar).

    I’m not sure the code you have in place around it – but you could remove the input on the back button and style the href with css instead.

    # June 10, 2011 at 3:34 pm

    Thanks! That worked.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.