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/Arrow2.png" border="0" />&nbsp;SEARCH</a>

How doI do that? thanks!
LVL 2
Starr DuskkASP.NET VB.NET DeveloperAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Ashish PatelConnect With a Mentor Commented:
okay finally try this

<form name="searchForm" method="get" action="/find.asp">
                        <a href="javascript:void(0);" onClick="document.searchForm.action='/find.asp';document.searchForm.submit();">
                        <span>
                            <img src="/template/images/Arrow2.png" border="0" />&nbsp;SEARCH</span></a>
0
 
Ashish PatelCommented:
<a href="javascript:document.forms[0].action='find.asp';document.forms[0].submit();">
                            <img src="/template/images/Arrow2.png" border="0" />&nbsp;SEARCH</a>
0
 
almilyoCommented:
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.submit();"><img src="/template/images/Arrow2.png" border="0" />&nbsp;SEARCH</a>
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
almilyoCommented:
sorry, that should have been

<a href="javascript:document.theform.submit();">

in my example.
0
 
Starr DuskkASP.NET VB.NET DeveloperAuthor Commented:
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/Arrow2.png" border="0" />&nbsp;SEARCH</span></a>

It submits to a page that doesn't exist:
/templatedefault.asp?

my path to this page is:
/template/default.asp
0
 
Ashish PatelCommented:
<form name="searchForm" autocomplete="off" method="post" action="/find.asp">
                        <a href="javascript:document.searchForm.action='/find.asp';document.searchForm.submit();">
                        <span>
                            <img src="/template/images/Arrow2.png" border="0" />&nbsp;SEARCH</span></a>
0
 
Starr DuskkASP.NET VB.NET DeveloperAuthor Commented:
I just did that too....
<a href="javascript:document.searchForm.action='/find.asp';document.searchForm.submit();">

it does the same error.
0
 
Starr DuskkASP.NET VB.NET DeveloperAuthor Commented:
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?
0
 
Starr DuskkASP.NET VB.NET DeveloperAuthor Commented:
No, switching to "post" doesn't do it either.
0
 
Ashish PatelCommented:
try re-changing it from post to get again
0
All Courses

From novice to tech pro — start learning today.