Solved

Form submit using image outside the form

Posted on 2000-03-18
2
315 Views
Last Modified: 2013-12-25
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
Comment
Question by:rdaudtnt
2 Comments
 
LVL 4

Accepted Solution

by:
CoolAss earned 50 total points
ID: 2631933
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
 
LVL 1

Expert Comment

by:damianosky
ID: 2635881
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Problem to be resolved in this article Currently, development of website and web application can be done without writing thousands of lines of programming code by hand. Description This can be done through by using a open source framework such …
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now