Changing the submit button...

admin

Administrator
Staff member
Hi All,<br />
How can I change the name that appears on the submit button on my form?<br />
I have used this code <INPUT TYPE="submit"> but the button on the form page shows 'submit query'. I would like it to just say 'submit'.<!--content--><input type="submit" value="Submit"><br />
<br />
Cheers,<br />
<br />
Tom<!--content-->Or you can make the button a image to make it more interesting.<br />
<br />
<button type=submit><img src=http://www.htmlforums.com/archive/index.php/"imagename"></button><!--content-->Originally posted by slayerspage.com <br />
Or you can make the button a image to make it more interesting.<br />
<br />
<button type=submit><img src=http://www.htmlforums.com/archive/index.php/"imagename"></button> <br />
uhh that would be <br />
<input type=image name=submit src=http://www.htmlforums.com/archive/index.php/"imagename" onClick="submit();"><br />
<br />
I do beleive that is it. no such tag as the button tag there slayer, nice try though. you were close. :)<!--content-->uhh that would be<br />
<input type=image name=submit src=http://www.htmlforums.com/archive/index.php/"imagename" onClick="submit();"><br />
<br />
onClick="submit();" will submit the form without firing a submit event - it's not the same as the submit() method of the form object. Also: using '<input type=image' will send an extra pair of name/value pairs along to the server (the x/y coordinates of the click on the image). And 'name=submit' is a bad idea as well...<br />
<br />
Otherwise, great advice...<!--content-->Originally posted by _mrkite <br />
<br />
<br />
onClick="submit();" will submit the form without firing a submit event - it's not the same as the submit() method of the form object. Also: using '<input type=image' will send an extra pair of name/value pairs along to the server (the x/y coordinates of the click on the image). And 'name=submit' is a bad idea as well...<br />
<br />
Otherwise, great advice... <br />
great advice when it apparently is all wrong :D thanks for correcting me _mrkite, but how would it be for an image? if you don't mind, just to set me straight.<!--content-->Originally posted by scoutt <br />
<br />
great advice when it apparently is all wrong :D thanks for correcting me _mrkite, but how would it be for an image? if you don't mind, just to set me straight. This uis what you are looking for:<br />
<br />
<!-- m --><a class="postlink" href="http://javascript.internet.com/forms/submit-link.html">http://javascript.internet.com/forms/submit-link.html</a><!-- m --><!--content--><form name="thisForm" ........etc.<br />
<br />
<a href=http://www.htmlforums.com/archive/index.php/"javascript:document.thisForm.submit()"><img border="0" src="image url"></a><br />
</form><!--content-->thanks guys, that cleared a few things up.<br />
<br />
so if I'ed included the form name it would have worked? correct<!--content-->Originally posted by scoutt <br />
thanks guys, that cleared a few things up.<br />
<br />
so if I'ed included the form name it would have worked? correct Yes, the form name in the javscript stuff. ;)<!--content-->scoutt -<br />
<br />
When you give a form a name (or an image, Netscape 4 Layer, some other elements) an additional reference (pointer) to the form object that represents that form is exposed (made available for scripting purposes). Since you can also get references to all forms in the page via the document.forms[] collection - an array - this additional reference is provided as a convenience, so you won't need to use document.forms[3], e.g., to find the fourth form in the source code. document.orderForm is a lot easier to follow (you can also use document.forms['orderForm'] or document.forms.orderForm or - in Internet Explorer - document.all.orderForm or document.getElementById('orderForm') (the last by also setting an id) or - well, you get the picture. First - find the object (that represents the element), the do something with it.<br />
<br />
If you know this already, apologies...<br />
<br />
_mrkite<!--content-->thanks _mrkite, that was very informational. I knew some of it but not in that way. you the man thanks..<!--content-->Originally posted by scoutt <br />
<br />
uhh that would be <br />
<input type=image name=submit src=http://www.htmlforums.com/archive/index.php/"imagename" onClick="submit();"><br />
<br />
I do beleive that is it. no such tag as the button tag there slayer, nice try though. you were close. :) <br />
<br />
err....there is such a tag as <button> but I'm not sure what browsers and browser versions support it, although IE seems to support it at least as early as version 4.<br />
Its pretty cool in that you can insert HTML code into a button that is not possible with the regular submit, reset buttons.<br />
<br />
<button type=submit><br />
<font color=red size=7>this is a big button</font><br />
</button><br />
<br />
<button type=reset><br />
<img src=http://www.htmlforums.com/archive/index.php/"reset.gif" ALIGN=middle><font color=red size=3>Reset</font><br />
</button><!--content-->Originally posted by kevin <br />
<br />
<br />
err....there is such a tag as <button> but I'm not sure what browsers and browser versions support it, although IE seems to support it at least as early as version 4.<br />
Its pretty cool in that you can insert HTML code into a button that is not possible with the regular submit, reset buttons.<br />
<br />
<button type=submit><br />
<font color=red size=7>this is a big button</font><br />
</button><br />
<br />
<button type=reset><br />
<img src=http://www.htmlforums.com/archive/index.php/"reset.gif" ALIGN=middle><font color=red size=3>Reset</font><br />
</button> <br />
<br />
I was gonna say that myself Kevin.. as I'd seen that in action.;) What I'm wondering is...you ccan change the font color, but what about the actual button color?<!--content-->To change the color of a button use CSS:<br />
<br />
<input type=submit style="background:blue;"><br />
<br />
there are many more style attributes you can use to change the appearance of buttons. <br />
<br />
Kevin<!--content-->Ahhhhh... and the light dawns! ;) Thaks bunches... now I have new things to play with.. heehee..<!--content-->Originally posted by kevin <br />
<br />
<br />
err....there is such a tag as <button> but I'm not sure what browsers and browser versions support it, although IE seems to support it at least as early as version 4.<br />
Its pretty cool in that you can insert HTML code into a button that is not possible with the regular submit, reset buttons.<br />
<br />
<button type=submit><br />
<font color=red size=7>this is a big button</font><br />
</button><br />
<br />
<button type=reset><br />
<img src=http://www.htmlforums.com/archive/index.php/"reset.gif" ALIGN=middle><font color=red size=3>Reset</font><br />
</button> <br />
have you ever had one of those days where nothing looks familiar.... well as dead as you are probably so :D:D about an hour after posting that I realized there was a button tag like that.<br />
<br />
soooo my appoligies to slayerspage.com, sorry bud. ;)<!--content-->The button element is defined in HTML 4.0 and available in IE4+ and NS6. It is useful because it functions as a rich HTML container, unlike the <image type=button> element.<br />
<br />
It is especially useful in conjunction with the 'accesskey' attribute for defining GUI-like 'shortcut' (or 'accelerator') keys.<br />
For instance:<br />
<button accesskey="B">Go <u>B</u>ack</button><br />
<br />
Here the user can fire a button click by doing Alt-B.<!--content-->
 
Back
Top