tags:

views:

46

answers:

3

I have a problem with my jsp file... inside it I have a form and in that form I have an onsubmit method that is basically calling a javascript... the problem is that whenever I click on a button it always redirects me to the page, whether it's true or false

+1  A: 

You probably need to return false after the javascript processing which is bound on the button click.

cherouvim
+1  A: 

what cherouvim said.

also, in the case that the onsubmit handler already should be returning false, if there's any javascript error in the handler, then the return statement may never get evaluated and the form will submit.

jonnyheadphones
+1  A: 

You likely have something like:

<form onsubmit="someFunction()">

instead of

<form onsubmit="return someFunction()">

Fix it accordingly.

BalusC