| re: Firefox submits form on hit another button...
Peet wrote:[color=blue]
> Hi there,
>
> Do somebody have some ideas about this behaviour?
>
> I have a struts application. It has a jsp which has a form and two
> buttons, one of them is html:submit, and the other is html:button.
>
> Submit has to post the form, of course, that works correctly on all of
> the browsers.
> But the other button has an onclick event declared. It calls the
> implemented javascript function in IE and in Opera, too, but Firefox
> submits the form as well when I hit submit button...
>
> Thanks in advance.
> Peter[/color]
When you have a button and you don't explicity declare a type for it,
the default type becomes a "submit" type. Other browsers honor this
except for IE, which defaults it to just a "button" type.
For example:
<form>
<button>
</form>
Except for IE, browsers will do a submit when the button is clicked.
<form>
<button type = "button">
</form>
Now, when you click on the button it will not do a submit. |