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#>";
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson