• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 335
  • Last Modified:

Form submit using image outside the form

I have one image (gif) and a form on my page. The image is outside the form region. I want to make this image a "clickable area" and issue a form submit when the user click on this image.

Is it possible?

I am using JavaScript at client, and VBScript and ASP at the server.
0
rdaudtnt
Asked:
rdaudtnt
1 Solution
 
CoolAssCommented:
Sure. First, make the image a normal link as in:

<A HREF="#"><IMG SRC="myimage.gif"></A>

Now do this:

<A HREF="#" onClick="document.forms('formname').Submit()"><IMG SRC="myimage.gif"></A>

That should do it. My Javascript is a little rusty, but it's more or less that.
0
 
damianoskyCommented:
Yes, CoolAss, this is a nice solution. You can also improve it (if, e.g, you want fields validation) calling in the on Click event a javascript function were you validate data and then, at the end of the function, if all is OK you give the command:

document.forms('formname').Submit()

Recent browsers support also this syntax:

document.formname.Submit()

Good work!

0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now