CFLib.org – Common Function Library Project

SubmitButton(name, value[, class][, width][, onClick])

Last updated April 24, 2002

author

Jesse Monson

Version: 1 | Requires: CF5 | Library: StrLib

Description:
Create a simple submit button by providing name, value, class, width, and onClick.

Return Values:
Returns a string.

Example:

<style>
.button_jesse_IXStudios{font-family:verdana;background-color:darkblue;color:white;}
</style>
<cfoutput>
#submitButton("subTest","Test","button_jesse_IXStudios",200,"alert('Hi')")#
</cfoutput>

Parameters:

Name Description Required
name The name of the submit button. Yes
value The value of the submit button. Yes
class The CSS class to use. No
width Width of the submit button. No
onClick JavaScript function to call when the button is clicked. No

Full UDF Source:

/**
 * Create a simple submit button by providing name, value, class, width, and onClick.
 * 
 * @param name 	 The name of the submit button. 
 * @param value 	 The value of the submit button. 
 * @param class 	 The CSS class to use. 
 * @param width 	 Width of the submit button. 
 * @param onClick 	 JavaScript function to call when the button is clicked. 
 * @return Returns a string. 
 * @author Jesse Monson (jesse@ixstudios.com) 
 * @version 1, April 24, 2002 
 */
function submitButton(name,value) {
	var class="";
    var width="";
	var onClick="";
	
	if (arrayLen(arguments) gte 3) {class = " class=""#arguments[3]#""";}
	if (arrayLen(arguments) gte 4) {width = " width=""#arguments[4]#"" style=""width:#arguments[4]#px""";}
	if (arrayLen(arguments) gte 5) {onClick = " onClick=""#arguments[5]#""";}	
	return "<input type=""submit"" name=""#name#"" value=""#value#""#width##class##onClick#>";
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson