General Functions Library

_createFields(object struct, [string type])
This function will create form fields based upon the structure passed to the function. The form field's name will be equal to the structure's key and the value of the form field will be equal to that of the key's value. The struct argument is required.

The type argument is optional and is used to specify the form field type to be created. Valid values are any valid TYPE attributes for the <INPUT> tag. The default value is "Hidden".

_isLength(string text, [int length], [string type])
This function will check to make sure the strings value is equal to length argument's value. It does this by stripping out all non-valid characters and comparing the length of the new string to argument length. If the lengths match, then true is returned, otherwise false is returned.

The length argument is an optional argument, which specifies the length that a valid phone number should be. The default value is 10.

The type argument is an optional parameter that defaults to "numeric." Valid values for the "type" argument are "numeric", "alpha" and "alphanumeric". Any character that does not match the type specified will be removed when comparing the lengths.

_getEventType(string type)
The _getEventType() function which returns the correct event handler that should be used when you wish to add an event that should happen as soon as the field value has been updated. This will return "onclick" for checkboxes and radio button, "onchange" for select boxes and "onblur" for all other field types.

The type argument is a required parameter that should be equal to the "type" property of the form field you wish to attach the event to.

_getState(string postalAbbr)
This function will return the full name of any valid 2-digit US postal abbreviation. The function will return null if the 2-digit postal abbreviation is invalid.
_getURLParams()
This function will return all of the URL parameters as a structure.
_listSum(string list, [string delimiters])
This function will sum all the totals in a list and return the value. The string argument is required.

The delimiters argument is optional, and defaults to a comma.

_listToArray(string list, [string delimiters])
This function will take a string list and return an array with all the values as an element of the array. This function actually trims all whitespacing from the items in the array before returning the value. The string argument is required.

The delimiters argument is optional, and defaults to a comma.

_ltrim(string text)
This function trims all whitespace from the left side of the string and returns the new value.
_rtrim(string text)
This function trims all whitespace from the right side of the string and returns the new value.
_sortOptions(objext field, [string order], [boolean byText])
This function will sort a select boxes' option array in either ascending or descending order by either the option's value or text value. The field argument is required.

The order argument is an optional argument specifying the order which to sort by. Valid values are "asc" and "desc". "Asc" will sort the option array in an ascending fashion. "Desc" will sort the array in a descending fashion. The default value is "asc".

The byText argument is optional value that defines whether to sort by the option's text value or by it's actual value. Valid values are true and false. The default value is true.

_stripInvalidChars(string text, [string type])
This function removes any non-valid characters from the string and returns the new string. Valid characters are defined by the type argument. The string argument is required.

The type argument is an optional parameter that defaults to "numeric." Valid values for the "type" argument are "numeric", "alpha" and "alphanumeric". Any character that does not match the type specified will be removed.

_transferOptions(object field1, object field2, [boolean sort], [string type], [boolean selectItems], [boolean reset])
This function will transfer the contents from select box field1 into select box field2.

The sort argument is an optional argument that can be used to specify whether the options in the field argument should be resorted in ascending order by the options text value once the transfer is complete. Valid values are true and false. The default value is true.

The type argument is an optional argument that is used to specify whether only the selected items should be moved, or whether all the items should be moved. Valid values are "selected" and "all". The default value is "selected."

The selectItems argument is an optional argument used to specify whether or not the moved items should be selected by default when moved to the new box. Valid values are true and false. The default value is true.

The reset argument is an optional argument used to determine whether or not the target select box should be cleared before moving the specified options. Valid values are true and false. The default value is false.

_trim(string text)
This function trims all whitespace from both side of the string and returns the new value.

[< Back] [Index] [Next >]