Solved

form submital...

Posted on 2000-03-25
3
342 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

617 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