| Function
| Description
|
|
ucFirst |
Returns a capitalised version of the supplied string.
1st letter upper case, all others lowercase |
|
Trim |
Returns the supplied string after removing all leading and trailing spaces
|
| stripHTMLTags | A
simple routine to strip HTML tags from supplied string. It's not very clever but
it's quite useful. Everything between each "<" and the subsequent ">" is ignored
hence it could get confused with any javascript comparisons or comments that contain
comparisons. |
|
ReadableName |
Returns a more readable version of the supplied
string. It converts the underscore character to a space and capitalises each word
within the name. e.g. "prod_desc" changes to "Prod Desc" |
|
isBlank |
Checks whether the supplied string is blank and returns a boolean. Blank is
interpreted as any combination of spaces, linefeeds and/or tab characters. |
|
isValidEmail | Checks
whether the supplied string is a valid email syntax and returns a boolean. General
format checked to be: something@something.domain
where domain is between 1 and 3 chars. |
|
isValidTime |
Checks the supplied string to be a valid time value of the format: hh:mm[:ss].
Hours, mins and Seconds are also checked for legal values. |
|
isValidNumber |
Checks the supplied string to be a valid integer |
|
isValidInterval |
Checks the supplied string to be a valid interval
of the format: n periods [n subperiods [nsubperiods etc]] where n is a
valid integer (negative allowed) and period is a valid period (days,months,years,weeks,
hours,mins,secs or abbreviations of) |
|
IsValidDate |
Checks the supplied string to be a valid date value
of the format: dd-mmm-yyyy. Days, months and years are also checked for legal
values. |
|
ConvertToJscriptDate |
Converts a general format date dd-mmm-yyyy into
a JavaScript Date format. |
|
isValidDateTime |
Checks the supplied string to be a valid date/time
value of the format: dd-mmm-yyyy hh:mm[:ss] |
|
isEarlierOrEqual |
Compares two dates and returns true if first date
is earlier or equal to the second date, otherwise false. |
|
isTimeEarlierOrEqual |
Compares two times and returns true if first time
is earlier or equal to the second time, otherwise false. |
|
LeapYear |
Returns true if the supplied year number is a leap year otherwise false. Leap
years are those years divisible by 4 (but not divisible by 100 unless divisible
by 400). |
|
frmValidateCommon |
A general purpose form validation routine which takes
an HTML form as its parameter. It loops through all text fields on the form and
verifies that they contain data (unless the optional attribute is set to true
for the field). Other attributes will force other validation checks. Supported
attributes are: Optional email date datetime time interval
numeric,min,max Any errors detected will
be presented to the user via an alert popup and input focus will be set to the
first field that a problem was detected with. JavaScript should be used to
set the relevant attributes, prior to invoking this routine.
E.g. onclick ='frm.timestamp.datetime=true; frm.comment.optional=true;
return frmValidateCommon(this)' would ensure that the field named timestamp
on the form named frm is a valid datetime and is mandatory the field named 'comment'
is allowed to be left blank. All other text fields would be mandatory. |
|
SetSelections |
This function will highlight the entries in the supplied option list field
that exist in the supplied comma separated list of values. e.g.
SetSelections(monthCombo,"Jan,Mar") Would highlight the items
named Jan and Mar in the combo named monthCombo. Note: the effect of setting multiple
values for a single level (pulldown) optional field are undefined and should not
be relied on. |
| InsertIntoList
| InsertIntoList(Combo,Text,Value,Pos);
Inserts the supplied Text and Value as a new element in the specified Option List/Combo.
The list is ordered alphabetically. The Pos parameter is optional and allows you
to specify which position to use. The function returns the position of the new
element. |
| AppendToList | AppendToList(Combo,
itemText, itemVal) Use this one for lists which aren't in alphabetical order,
otherwise use the InsertIntoList routine. I find this routine useful where I need
a list of items that may need to be manually reordered by the user (e.g. prioritisation
of items). The ShiftListSelections can then be used to move items up and down
in the list. |
| DeleteFromList |
DeleteFromList(Combo,Pos)
Simply deletes the entry at position Pos in the supplied option list. |
| MoveSelectedListItems | MoveSelectedListItems(srcCombo,
destCOmbo, doSort, IntSort, UseVals) Moves the currently selected items from
the source option list into the destination option list. If the doSort parameter
is set to true, the dest list will be sorted according to the other supplied paramaters
(see SortList for details). Note: This routine is much faster than lots of individual
InsertToList calls and should be used for large option lists. |
| SortList | SortList(Combo,
IntSort, UseVals) Sorts the supplied option list alphabetically based on
its displayed values. If you need a numerical sort, you can set the IntSort parameter
to true. If you need to sort the option list based on its underlying value (as
opposed to the displayed value), then set the UseVals parameters to true. |
| ShiftListSelections | ShiftListSelections(Combo,Down)
This routine will shift all the items currently selected in the list up one
place (or down one if Down=true). It is expected to be used with multi line option
lists where users need to manually select the order of the items within the list. |
|
NewWindow |
NewWindow(url,title,width,height,scrollbars,resize) Opens a url in a popup
window centered in the middle of the screen, the size of the window is governed
by the supplied width and height parameters. I don't think the title parameter
works and the scrollbars and resize params only work for intenet explorer (true/false
values). |