Click to See Complete Forum and Search --> : Submit form by text or image link


LocalHero
07-08-2005, 04:16 AM
I have my site set up with two images and text. I want all three to submit the same form. I thought this would work:

<form name="form1" method="post" action="imagestemplateC.php">
<input type="hidden" name="simage" value="bomb">
<a href="javascript: document.form1.submit()">
<img src="../shirtimages/bomb.jpg" /><br />
<img src="../shirtimages/customize.png" width="158" height="18" /><br />
<span class="style33">Bomb</span></a> <br />
</form>

Any ideas? Does it look like it should work? The error I get in IE is "object doesn't support this property or method". In Mozilla I get - document.form1.submit is not a function.

Charles
07-08-2005, 04:26 AM
<input alt="Submit" src="../shirtimages/bomb.jpg" type="image">

LocalHero
07-08-2005, 04:29 AM
Ok... what about the text? If possible, I wanted something that wrapped around all three, but I'll take whatever works. How would I get the text to submit the form? Thanks

LocalHero
07-08-2005, 04:38 AM
I found it! I had another form with the same name. Thanks Anyway!

Charles
07-08-2005, 04:42 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<meta name="Content-Style-Type" content="text/css">
<title>Example</title>

<style type="text/css">
<!--
fieldset {color:#000; padding:1ex; width:13em}
label {display:block; text-align:right}
label.required {color:#f00}
label.required:before {content:"*"}
input {margin-left:1ex; width:10em}
button {border:none; background-color:#fff; color#000; cursor:pointer; display:block; margin:1ex auto}
-->
</style>

</head>
<body>
<form action="some-script.pl">
<fieldset>
<legend>Pets</legend>
<label class="required">Name<input type="text"></label>
<label class="optional">Religion<input type="text"></label>
<button type="submit">Submit</button>
</fieldset>
</form>
</body>
</html>