2 Replies - 245 Views - Last Post: 20 October 2011 - 06:37 AM

#1 fallenreaper  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 240
  • Joined: 19-June 10

anchor tag to submit a form to server not working

Posted 20 October 2011 - 04:48 AM

RESOLVED

i have a form with information in it, but to make it cleaner, i want to use an anchor tag to submit.


the way i have it now is as follows:
<head>
function submitter(formNum){
	document.getElementById('form'+formNum).submit();
}
</head>
<body>
<form...>
<input type="hidden" size="60" name="iitraks" value = "1234">
<input type="hidden" name="IIFORM" value="01">
<input type="hidden" name="IICNT1" value="N">
<br /><a href ="javascript:submitter(2);">send it</a>
</form>
</body>



There will be X number of these forms, so i was going to iterate through, and make em all form1, form2, form3, etc... and then pass in the number in the function which will submit. It doesnt seem to work.

Alternate plans were do change the
<a href="javascript:void(0)" onclick="submitter(2); return false">send it</a>
which also didnt seem to work.

It needs to run on IE7, but that shouldnt be a problem.

This post has been edited by fallenreaper: 20 October 2011 - 04:56 AM


Is This A Good Question/Topic? 0
  • +

Replies To: anchor tag to submit a form to server not working

#2 fallenreaper  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 240
  • Joined: 19-June 10

Re: anchor tag to submit a form to server not working

Posted 20 October 2011 - 04:56 AM

figured it out. TOPIC CLOSED. Needed to put single quotes around the 2 in the function.
Was This Post Helpful? 0
  • +
  • -

#3 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3489
  • View blog
  • Posts: 10,057
  • Joined: 08-June 10

Re: anchor tag to submit a form to server not working

Posted 20 October 2011 - 06:37 AM

I wouldn’t put the JS in the href attribute, rather in the onclick. (though personally I’d do it completely in JS)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1