/    Sign up×
Community /Pin to ProfileBookmark

Onsubmit help

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

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@FangMar 02.2009 — When the form submits it is reloaded, it does not continue with the script.

Why are you using 2 forms?
Copy linkTweet thisAlerts:
@agrizauthorMar 02.2009 — Hi,

Thank you for your reply. Actually i saw the reloading. That is why i gave return false for the form submits...

i have some iframes which will load data from every from i have. I have more number of forms. The main forms will have a text field which will also passed with the other forms

I am trying to solve this for the last two days. I did not get any clue.

Is there any possible to submit the second form through first form. Even though there will be some solutions, i am become mad to find a solution for this.

Thanks
Copy linkTweet thisAlerts:
@FangMar 02.2009 — You probably don't need more than 1 form. Any data sent by the form can be processed by the server side script.
Copy linkTweet thisAlerts:
@agrizauthorMar 02.2009 — Yes.. You are right..

I think i am trying for some complex solution where a simple solution available.

Thanks for spending your time with me.

Your idea is really great.

Thanks
×

Success!

Help @agriz spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...