Solved

form submital...

Posted on 2000-03-25
3
341 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Why is my $_POST not going to results page 10 69
close pop up windows when logout or main window closes 17 86
.CSS HTML Help 3 58
Undefined variable with $_POST in PHP 5 40
This article discusses four methods for overlaying images in a container on a web page
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
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…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

751 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