Solved

form submital...

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
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)

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