View Full Version : Form submitting when clicking in the input box

01-07-2008, 08:28 PM
I have a form on a page and it is one input box and one image submit button. The button comes before the form on the page. The problem I am having is that the form submits itself as soon as I click in the input box without even clicking on the submit button. It doesn't happen in IE though. Only Firefox and Safari.

Any help on this would be greatly appreciated.

Thank you!

<div id="toplogo"><form action="<?php $_SERVER['PHP_SELF']; ?>" method="POST">
<input name="submit" type="image" src="images/button_search.jpg" alt="Search Now" align="top" width="29" height="9" style="padding-top: 18px; padding-right: 10px; background-color: none;" tabindex="2">
<input name="textfield" type="text" id="textfield" size="27" tabindex="1" class="searchbox">

01-07-2008, 08:51 PM
Okay, I noticed that if I move the image submit button to the other side of the input box it works fine in IE / FF and Safari. Anyone know a way that I can have the submit button first in FF and Safari without it submitting as soon as I click in the first input box?

01-07-2008, 08:57 PM
Remove the label, you aren't using it properly anyways. Its also causing your issues because the label brings focus to the first element that is within it.

01-07-2008, 08:59 PM
Thank you. Yeah, I was going back and forth between textmate and dreamweaver. I guess dreamweaver threw that in and I didn't even notice it.

That fixed the problem!