Starr Duskk
asked on
anchor tag to submit a form
How do I get an anchor tag to submit a form?
this is what I have now....
<input type="image" name="update" src="/images/go_button.jpg "
width="59" height="30">
instead I want this to submit the form...
<a href="/find.asp">
<img src="/template/images/Arro w2.png" border="0" /> SEARCH</a>
How doI do that? thanks!
this is what I have now....
<input type="image" name="update" src="/images/go_button.jpg
width="59" height="30">
instead I want this to submit the form...
<a href="/find.asp">
<img src="/template/images/Arro
How doI do that? thanks!
make sure you have a name in the form tag, so it looks something like
<form name="theform" >
And then write your link as
<a href="javascript:document. myform.sub mit();"><i mg src="/template/images/Arro w2.png" border="0" /> SEARCH</a>
<form name="theform" >
And then write your link as
<a href="javascript:document.
sorry, that should have been
<a href="javascript:document. theform.su bmit();">
in my example.
<a href="javascript:document.
in my example.
ASKER
I must be doing something wrong. Here is my form:
<form name="searchForm" autocomplete="off" method="get" action="/find.asp">
<a href="javascript:document. searchForm .submit(); ">
<span>
<img src="/template/images/Arro w2.png" border="0" /> SEARCH</span></a>
It submits to a page that doesn't exist:
/templatedefault.asp?
my path to this page is:
/template/default.asp
<form name="searchForm" autocomplete="off" method="get" action="/find.asp">
<a href="javascript:document.
<span>
<img src="/template/images/Arro
It submits to a page that doesn't exist:
/templatedefault.asp?
my path to this page is:
/template/default.asp
<form name="searchForm" autocomplete="off" method="post" action="/find.asp">
<a href="javascript:document. searchForm .action='/ find.asp'; document.s earchForm. submit();" >
<span>
<img src="/template/images/Arro w2.png" border="0" /> SEARCH</span></a>
<a href="javascript:document.
<span>
<img src="/template/images/Arro
ASKER
I just did that too....
<a href="javascript:document. searchForm .action='/ find.asp'; document.s earchForm. submit();" >
it does the same error.
<a href="javascript:document.
it does the same error.
ASKER
oh wait. I see you are doing a "post" method and my code has a "get" method.
(existing code, trust me, I'd never do a "get"....)
Is that the problem?
(existing code, trust me, I'd never do a "get"....)
Is that the problem?
ASKER
No, switching to "post" doesn't do it either.
try re-changing it from post to get again
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<img src="/template/images/Arro