Solved

Form submit using image outside the form

Posted on 2000-03-18
2
318 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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

840 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