|
Posted by Steve Belanger on 02/24/06 16:18
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"
value="save">
Now inside the function itself, if the form is set to be submitted, do this
just before the return true line:
document.abc.submit();
Hope this helps.
Steve.
"Umesh" <mec.umesh@gmail.com> wrote in message
news:1140775388.749370.260940@v46g2000cwv.googlegroups.com...
> Hi
>
> Here is the sample code for my form, but problem is that it submits
> twice in some cases when i click submit button.
>
>
> <script>
> function validateform (){
> //do a lot validation here, if validation failes, return false;
>
>
> //finaly this line
> return true;
>
>
> }
>
>
> </script>
>
> <form name="abc" action="any other apge" onsubmit = "return
> validateform();">
>
>
> <input type="submit" name="save" id="save" value="save">
> </form>
>
>
> Can any one help me?
>
[Back to original message]
|