views:

47

answers:

1

Question level : Intermediate / Beginer

I created a form with

`method="post" action="eh.do" onsubmit="return Form1_Validator(this)"`

The validation is successful and works fine when i hit submit.

But on the servlet, i have a concatenate function to merge the values together.

When the java script is turned on, ie when i write onsubmit="return Form1_Validator(this)" it shows

java.lang.NullPointerException
    java.lang.String.concat(Unknown Source)
    EditHelper.doPost(EditHelper.java:27)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

But once the java script is disabled ie i delete out onsubmit="return Form1_Validator(this)", it works fine.

If all conditions are true, my script returns

return (true);

Is this the problem ?

I tried return(theForm);

but the problem remains the same!

+2  A: 

I'd use Firebug to see how the form submit request parameters change if you add your onsubmit handler. I guess your javascript code is somehow influencing those parameters and once you see what happens, it might become obvious why this is.

Adrian Grigore