By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,253 Members | 1,680 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,253 IT Pros & Developers. It's quick & easy.

submit

P: n/a
Why this work?

<a href="#" onClick="Forma1.reset()">Link1</a>

and this not?

<a href="#" onClick="Forma1.submit()">Link1</a>

I get error.

Thanks!

--

Andrej Levenski
PROVOX - Multimedia Studio
mob 098/326 897
tel 01/6184 612
an****@provox.hr
Jul 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
What doesn't work? what browser?

Works for me in IE 5.5 it may be that you need to return false after the
reset to stop for form from submitting.

Stu

"LevaOpaki" <le*******@net.hr> wrote in message
news:bo**********@ls219.htnet.hr...
Why this work?

<a href="#" onClick="Forma1.reset()">Link1</a>

and this not?

<a href="#" onClick="Forma1.submit()">Link1</a>

I get error.

Thanks!

--

Andrej Levenski
PROVOX - Multimedia Studio
mob 098/326 897
tel 01/6184 612
an****@provox.hr

Jul 20 '05 #2

P: n/a
LevaOpaki wrote:
Why this work?
<a href="#" onClick="Forma1.reset()">Link1</a> and this not?
<a href="#" onClick="Forma1.submit()">Link1</a>
Becuase one changes the form, then goes to a URI. The other goes to a URI,
and then goes to a different URI before anything can happen.

.... but read:
* http://jibbering.com/faq/#FAQ4_24 (note the use of the word 'meaningful')
and
* http://tom.me.uk/scripting/submit.asp
I get error.


Really? Then you probably have an input named submit.

--
David Dorward http://dorward.me.uk/
Jul 20 '05 #3

P: n/a

"LevaOpaki" <le*******@net.hr> wrote in message
news:bo**********@ls219.htnet.hr...
Why this work?

<a href="#" onClick="Forma1.reset()">Link1</a>

and this not?

<a href="#" onClick="Forma1.submit()">Link1</a>

I get error.

Thanks!


Thanks to all.
I find error.
My other submit button name was "submit". :)))
Jul 20 '05 #4

P: n/a

"Stuart Palmer" <tr**********@youcant.com> wrote in message
news:bo**********@sp15at20.hursley.ibm.com...
What doesn't work? what browser?

Works for me in IE 5.5 it may be that you need to return false after the
reset to stop for form from submitting.


<a href="javascript:document.Forma1.submit();">Submit </a>

I try this now and not working.
Forma1 is my form name.
Reset is working good.
Always troving an error.

"
A Runtime Error has occurred.
Do you wish to Debug?

Line: 0
Error: Object doesn't support this property or method
"

I'm using IE 6.0

Thanks!
Jul 20 '05 #5

P: n/a
LevaOpaki wrote:
Why this work?

<a href="#" onClick="Forma1.reset()">Link1</a>

and this not?

<a href="#" onClick="Forma1.submit()">Link1</a>

I get error.

Thanks!


Without more information I'm guessing, but my guess is that you
have a form element named "submit" on your form, such as:

<input type="submit" name="submit" value="Go" />

If you have something similar to the above line, change the name
of this input element to something other then "submit".

Also, never just refer to the name of the form, your code will
work in Internet Explorer, but will fail in almost every other
browser, because "Forma1" will be undefined.

<a href="#" onclick="document.forms['Forma1'].submit();return
false;">Link 1</a>

The "return false" is also necessary. It may seem to be
unnecessary because the submit() means it never executes,
however, in at least one web browser (Internet Explorer 5) the
onclick event fires, begins to submit the form, then immediately
follows the HREF attribute, cancelling the form submission. The
net effect is that in IE5, calling submit() as shown above
without returning false appears to do nothing.

Lastly, the link above will only work if JavaScript is enabled, a
solution similar to the one below will make the form work
regardless of client-side JavaScript support:

<style type="text/css">
input.submitBtn {
background-color: transparent;
border: none;
text-decoration: underline;
color: blue;
cursor: pointer;
cursor: hand;
}
</style>
<form>
<input type="submit" id="submitId" name="submitName"
value="Click here" class="submitBtn" />
</form>

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available
at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.