1

I have two forms, a login form and a register form on the same page and each has its own submit button. If I fill in bad data and click on submit button on register form, I get the form back with errors ( expected). If I now enter sign in details on signin form and click on signin form's submit button, the register form gets submitted.

This is strange behaviour. I am not sure where to start search for this. I am using firefox to test this.

Thanks

ShaggyInjun
  • 2,880
  • 2
  • 31
  • 52
  • 2
    Post your code here... it will help to find an error? Whether you use same action page for two forms or different? – Suresh kumar Jul 30 '12 at 06:27
  • Also try to isolate the problem as much as you can. Take the minimal amount of HTML needed to reproduce this an paste it into a http://jsfiddle.net/ – Jonas G. Drange Jul 30 '12 at 07:44
  • 1
    You probably have a nesting problem (i.e. both submit buttons are inside the same form), but couldn't be sure without seeing the code... – Pedro Cori Nov 06 '12 at 20:44
  • @Shaggylnjun Please follow up on your question and tell us if you have found the answer. – Mohammed Joraid Dec 20 '13 at 03:32

1 Answers1

4

Well, you will need to debug it step by step.

  • Check your form nesting and follow good structure, make sure both form are not overlapping with each other or not being closed properly.
  • Give you form a proper ID and NAME. Be careful when two forms have the same name From Name Attr.
  • Based on your structure and your question, make sure you have a different submit buttons for each form and that button is placed within the form nesting.
  • Same as for the forms, give your submit button a proper unique ID and NAME .
  • Choose whether you want to submit by your using submit in html, or having JS to submit the form for you JS submit form.
  • If you are using HTML5, you can separate the button from the FORM. They can run separately. Means dynamic association between the form and it's submit button by having submit button placed anywhere and can submit a form located in different place. Check Association of Controls and Forms & HTML5′s New “form” Attribute.

Please post some code in order for us to have a better understanding of your issue. Good luck.

Community
  • 1
  • 1
Mohammed Joraid
  • 6,202
  • 2
  • 27
  • 38