PDA

View Full Version : Using submit button for Forms...


stag
01-23-2007, 08:03 PM
Hi,

I wish to use a logo, graphical thing instead of the defult "submit" button in Forms. Wold using image field icon work and if so, how would this work? If this cannot be done, how would I go about doing or learning?

Cheers

davidj
01-23-2007, 08:21 PM
an image field will replace a submit button. You can use any graphic to do this

or

you could use any image and asign a JS onClick to the <img src="pic.jpg"


<img src="pic.jpg" onClick="submiter()" >

//// JS Function ////////////////
function submiter(){
document.forms[0].submit();
}


i prefer to use the JS method as this allows me to add validation before the submit

stag
01-23-2007, 08:48 PM
right, with the code i place the onclick... bit. As ive not use JS, how would i go about using this code? Sorry, i understand, just not the JS code bit...

davidj
01-23-2007, 08:59 PM
please examine the following

try to understand it

all JS functions are placed inside the script tags


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript" type="text/javascript" >
//// JS Function ////////////////
function submiter(){
document.forms[0].submit();
}
</script>
</head>
<body>
<img src="image.jpg" width="50" height="20" onClick="submiter()" />
</body>
</html>

stag
01-23-2007, 09:58 PM
Yes, got that :)
And then using the CGI scipt from hosting company, inputting as per usual in DW?

davidj
01-24-2007, 05:49 AM
what do you mean?