Forum Moderators: open

Message Too Old, No Replies

Onsubmit help

         

agriz

8:46 am on Mar 2, 2009 (gmt 0)

10+ Year Member



Hi,

I have two forms.

<form name="one" id="one" method="post">
<input name="" type="submit">
</form>

<form name="Mone" onsubmit="return fun()">
<input name="" type="submit">
</form>

When i click submit the second form ---> it should submit the first one.

function fun(){
document.forms[0].submit();
document.forms[0].onsubmit = function()
{
alert('sdfdsfs');
return false;
}
return false;
}

But i don't know what is wrong here. I am not getting the alert...

Can anyone help me with this..?

Any help is really appreciated.

Thanks

birdbrain

12:33 pm on Mar 2, 2009 (gmt 0)



Hi there agriz,

try it like this...

***********************************************************

<script type="text/javascript">
function fun(){
document.forms[0].submit();
alert('sdfdsfs');
return false;
}
</script>

***********************************************************

<form name="one" id="one" method="post" action="http://www.example.com">
<input name="" type="submit">
</form>

<form name="Mone" onsubmit="return fun()" action="#">
<input name="" type="submit">
</form>

***********************************************************


birdbrain