Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.submit() not working? 1

Status
Not open for further replies.

snoopy75

Technical User
Aug 24, 2001
340
US
I don't understand. I have a link on my page that looks like this:
Code:
<a href=&quot;javascript:;&quot; onClick=&quot;deleteNom();&quot;>Delete Nomenclature</a>
...which fires this function:
Code:
function deleteNom() {
	if (confirm(&quot;Really delete this Nomenclature and all items under it?&quot;)) {
		form3.submit();
	}
}
... which supposedly submits this form:
Code:
<form name=&quot;form3&quot; id=&quot;form3&quot; method=&quot;POST&quot; action=&quot;<%=MM_editAction%>&quot;>
  <input type=&quot;hidden&quot; name=&quot;MM_delete&quot; value=&quot;form3&quot;>
  <input type=&quot;hidden&quot; name=&quot;MM_recordId&quot; value=&quot;<%= rsDetail.Fields.Item(&quot;EquipmentID&quot;).Value %>&quot;>
</form>
Through experimentation, I've discovered that the onClick event works... the function works... and the form seems to get submitted, but without the post data, so nothing actually happens. Have I got something wrong? Thanks in advance. :)

--Ryan
 
try this...

document.form3.submit();

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
is there a named submit button on the page at all (with in the form tags)


_____________________________________________________________________
onpnt2.gif

Hakuna matata!!
 
Code:
document.form3.submit();
does not work. Neither does
Code:
document.all.form3.submit();
.

There is not a named submit button in this form. I didn't think it was necessary? I don't want the user to be able to submit the form by themselves. I want this Javascript function to do it. I've done it before on other pages, but this one isn't working, and it's stumping me. [evil]

--Ryan
 
snoopy75,

Maybe this will help, I've changed some stuff for testing
but you can put it right when you figure out what's wrong.

Code:
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>
<html><head><title>TEST</title><script>
function deleteNom() {
    if (confirm(&quot;Really delete this Nomenclature and all items under it?&quot;)) {
        document.form3.submit();
    }
}
</script></head><body>
<a href=&quot;#&quot; onClick=&quot;javascript:deleteNom();&quot;>Delete Nomenclature</a>
<form name=&quot;form3&quot; id=&quot;form3&quot; method=&quot;POST&quot; action=&quot;[URL unfurl="true"]http://test&quot;>[/URL]
  <input type=&quot;hidden&quot; name=&quot;MM_delete&quot; value=&quot;form3&quot;>
  <input type=&quot;hidden&quot; name=&quot;MM_recordId&quot; value=&quot;test&quot;>
</form></body></html>

2b||!2b
 
works fine for me as a GET to the same page...POST should work fine too



=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
Okay... Thanks to Lrnmore, I've got it... Here's what made the difference:

Code:
<a href=&quot;javascript:;&quot; onClick=&quot;deleteNom();&quot;>Delete Nomenclature</a>
didn't work, but
Code:
<a href=&quot;#&quot; onClick=&quot;deleteNom();&quot;>Delete Nomenclature</a>
did.

I wonder why? Could it be that the
Code:
javascript:;
cancelled out the onClick event somehow? [neutral]

Anyway, it works perfectly now. Thanks! [thumbsup2]

--Ryan
 
you would need a void(0) in there
eg:
javascript:void(0);

_____________________________________________________________________
onpnt2.gif

Hakuna matata!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top