...

View Full Version : simple button error I think?



CeeN
01-15-2004, 05:27 PM
hey,

I have a submit button like so:

<form action="http://www.volconvo.com/index.php?act=Search&f="> <input type='image' height=16 name='submit'

width=57 alt="advanced search" src="http://www.volconvo.com/advanced.gif" align='middle'

/></form>

and it won't go to the link for some reason...it shouldn't be this hard heh..

DoubleV
01-15-2004, 05:44 PM
you seem to think that if you put an image into a <form> it will automatically act as a button, but it is not so. you just placed an image like any other image onto your web page. what you need to do is give your form a name and then add a onclick even to your image like this:

<form action="http://www.volconvo.com/index.php?act=Search&f=" name="my_form">
<input type='image' height=16 name='submit' width=57 alt="advanced search" src="http://www.volconvo.com/advanced.gif" align='middle' onclick="my_form.submit()" />
</form>

CeeN
01-15-2004, 05:55 PM
hmm..just tried that, and it didn't work...still takes me to a weird page: http://www.volconvo.com/index.php?submit.x=36&submit.y=11

Choopernickel
01-15-2004, 08:00 PM
According to the spec (http://www.w3.org/TR/html4/interact/forms.html#h-17.4.1), DoubleV is quite plainly wrong. It is true, Ceen, if you had used an <img> tag, you'd need an onclick event trigger. With an <input type="image"> you should be fine.

Do you have a demo page? I'm willing to bet the issue is your form's method crossing wires with the query-string variables in the form's action. Try method="post", or failing that, move the "?act=Search&f=" into two hidden inputs (name="act" value="Search"><input name="f"). That might do the trick.

CeeN
01-15-2004, 08:03 PM
http://www.volconvo.com/index.php?act=home

Choopernickel
01-15-2004, 08:30 PM
I don't see your image-input for a search.

Can you work up a small demo and see if you can localize the issue?

DoubleV
01-15-2004, 10:00 PM
Originally posted by Choopernickel
It is true, Ceen, if you had used an <img> tag, you'd need an onclick event trigger. With an <input type="image"> you should be fine.
I was answering in a hurry and the fact that CeeN used <input type="image"> and not an <img> tag had completely bypassed me. :o
sorry!

CeeN
01-15-2004, 10:05 PM
hmm..so how should I do this :( I have no idea what to do now lol

Garadon
01-15-2004, 10:27 PM
what is the point of having a form with only an image as input?
couldn't you then just as well have an image tag surround by an anchor tag?

CeeN
01-15-2004, 10:35 PM
no, for some reason it doesn't line up that way with the other image...wow I didn't think it would be this hard heh



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum