Solved

form submital...

Posted on 2000-03-25
3
338 Views
Last Modified: 2006-11-17
This may sound like I'm simple, but im going to ask anyway...

I have a form, that I want to put an image into as an image type.  On_click it opens a new window that has some text.  the new window itself closes on_blur.  My problem is that if I dont give the form itself an action, it submits to itself when the user clicks the input image.

<form name = 'myForm'>
<input type = 'image' src = 'fooBar.jpg' onclick = 'window.open('Cart.asp?prodID=1','cart','width=200,height=300')'>
</form>

I could probably write a script to do this (havent really thought about it), but I am not building the pages, just fixing them, and I have hundreds of these to change.  so for times sake I am really trying to minimize the changes I'm making to each individual page.  which is why i am using the form.

basically i just need to know is it possible to have an image input type that doesnt submit the form?  and without another anchor on it?

Thanks!
0
Comment
Question by:Hooligan
3 Comments
 
LVL 2

Accepted Solution

by:
HolySpirit earned 115 total points
ID: 2657764
Hooligan,
Try this :
<form name = 'myForm'>
<img src = 'fooBar.jpg' onclick = 'window.open('Cart.asp?prodID=1','cart','width=200,height=300')'>
</form>

So the form won't submit while user click the image ...

-- Holy Spirit
0
 
LVL 19

Expert Comment

by:daveamour
ID: 2657776
<Input Type="Image".... submits the form

thats what it does

cant change that

If you dont specify an action in the Form tag it assumes its submitting to itself

You could write an onSubmit Javascript function to trap the submission and take control

Dave
0
 
LVL 8

Expert Comment

by:jbirk
ID: 2660700
Example of what Dave said:
<form name = 'myForm' onSubmit="return false;">


-Josh
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Introduction The Google Maps API offers various ways to draw dynamic and static maps.  Using a combination of PHP and JavaScript, you can draw active JavaScript maps that allow pan-and-zoom in the client browser window.  You can also draw "static" …
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

773 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