document.form.submit() does not work??????????????

HI All

Either i am missing the boat somwhere or i am going completely mad.

for some reason i have the following

<form name="form1" action="">

<input type="button" name="button" onClick="document.form1.submit();">

</form>

This does not work, not matter how i do it, even if i put the submit call in a function and call the function from the button the form does not submit.

Anybody have any ideas?

Regards
mwskuzzyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

contactkarthiCommented:
<form name="form1" action="">

<input type="button" name="button" onClick="javascript:document.form1.submit();">

</form>
0
ZvonkoSystems architectCommented:
In a form you can simplify your event handler to this:
<form name="form1" action="">

<input type="button" name="button" onClick="this.form.submit();">

</form>

BUT!

It will NOT work if you have this:
<form name="form1" action="">

<input type="button" name="button" onClick="this.form.submit();">

<input type="submit" name="submit" >
</form>

If you have an element in the form with the name "submit" then submit() will not work.
Rename that element to "Submit"

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Maverick_CoolCommented:
whats ur action url
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

cookiejCommented:
Well, an action might be a good thing to add...!

Two ways to do it.

1)
<form name='form1" action="dosomething.php">
    <input type='submit' name='Submit me, Baby!">
</form>

-or-

function submitTheForm() {
    theForm = document.form1;
    theForm.action = "dosomething,php"
    theForm.submit();
}

...

<form name='form1" action="dosomething.php">
    <input type='submit' name='Submit me, Baby!">
</form>
0
mwskuzzyAuthor Commented:
No way! I cant beleive it? I would never have guessed that.

Thanks dude.
0
Michel PlungjanIT ExpertCommented:
@cookiej your should be

<script>
function submitTheForm(theForm) {
    theForm.action = "dosomething.php"
    theForm.submit();
}
</script>
...

<form name='form1" action="dosomething.php">
    <input type='button' onClick="submitTheForm(this.form)" name='Submit me, Baby!">
</form>
alternatively
<a href="#" onClick="submitTheForm(document.form1); return false">Submit me, Baby!</a>
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.