Page Submits twice

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Here is the sample code for my form, but problem is that it submits
twice in some cases when i click submit button.

function validateform (){
//do a lot validation here, if validation failes,  return false;

//finaly this line
return true;



<form name="abc" action="any other apge" onsubmit = "return

<input type="submit" name="save" id="save" value="save">

Can any one help me?

Re: Page Submits twice

Even though your question has to do with Javascript and this is an HTML
group, here's something that might help you.

Get rid of the onsubmit parameter on the form.

Use it on the button itself, like this:

<input type="button" onclick="validateform()" name="save" id="save"

Now inside the function itself, if the form is set to be submitted, do this
just before the return true line:;

Hope this helps.

Quoted text here. Click to load it

Re: Page Submits twice

Quoted text here. Click to load it

"Anything goes here.  For anal HTML-only chat try CIWAH."

Quoted text here. Click to load it


Quoted text here. Click to load it

That's nuts.  The OP now has a form that *won't* submit if JavaScript is

The OP hasn't helped himself by failing to provide the appropriate code.  
The snippet he gave is useless.  It like saying "I can't get a good
picture on my TV.  I've got a black cable and a blue one."


Hywel /

Re: Page Submits twice

On Fri, 24 Feb 2006, Steve Belanger wrote:

Quoted text here. Click to load it

Translation: "beware of off-topic answers, which would likely be
disputed if only they appeared in an appropriate group".

Site Timeline