| Method Summary | |
<static> String
|
alpha(<Event> evt)
Called if this form element can contain only letters. |
<static> String
|
alphanumeric(<Event> evt)
Called if this form element can contain only letters and numbers. |
<static> void
|
autotrim(<Event> evt)
If we want the form element to auto trim the white space, we can set this attribute. |
<static> Boolean
|
checkForm(<Object> frm)
|
<static> <private> String
|
displayError(<Event> elem, <String> errType, <String> msg)
Error Information Displays the error based upon the status of the error checking. |
<static> String
|
email(<Event> evt)
This element must be a standard valid e-mail address. |
<static> <private> String
|
fixNaming(<String> inString)
Convert the humpBack notation into English readable for determining form element names. |
<static> DOMObject
|
getTarget(<Event> evt)
Determine the target. |
<static> void
|
initializeValidation()
Call this function after a the form(s) have been loaded and the appropriate tests will be attached to the onblur method of the form element. |
<static> String
|
internationaldate(<Event> evt)
Called if this form element is an international formated date value (year-month-day). |
<static> String
|
matches(<Event> evt)
The value of this form element must match another form element's, value. |
<static> String
|
maxlen(<Event> evt)
This element cannot have more than the number of charcters that the attribute value specifies. |
<static> String
|
maxval(<Event> evt)
Called if this form element cannot be above the value specified within the value of the attribute. |
<static> String
|
maxwords(<Event> evt)
Called if this form element cannot have more than a certain number of words. |
<static> Boolean
|
meetsRegEx(<String> string, <String> regEx)
Determine if there was a match with the regular expression and the string. |
<static> String
|
minlen(e)
This element must be at least n characters long as specified by the attribute value. |
<static> String
|
minval(<Event> evt)
The value of this form element cannot be below the value specified within the value of the attribute. |
<static> <private> Boolean
|
myAttachEvent(<DOMObject> obj,<Event> evt,<Function> func)
Attached a function to an event for a given object. |
<static> String
|
notfirst(<Event> evt)
Called if this form element, a drop down element or a list box, is not the first element as the selected element. |
<static> String
|
numeric(<Event> evt)
Called if this form element can contain only numbers. |
<static> String
|
numgt(<Event> evt)
The number in the given field must be larger than the field associated as the value in the attribute numgt. Note: This will not make the entry requried. |
<static> String
|
numgte(<Event> evt)
The number in the given field must be larger than or equal to the field associated as the value in the attribute numgt. Note: This will not make the entry requried. |
<static> String
|
regex(<Event> evt)
Called if this form element must match a regular expression. |
<static> <private> void
|
removeErrorNode(<DOMObject> elem, <String> errType)
If the error has been resolved, it will remove the error node and reset any styles. |
<static> String
|
required(<Event> evt)
This element cannot be left blank. |
<static> String
|
ssn(<Event> evt)
This attribute is used to check to see that the form element is using a SSN format. |
<static> String
|
time(<Event> evt)
Called if this form element is a time value of hours and minutes. This attribute will allows for: This formating does not allow for 24 hour time telling, sometimes called "Military Format". |
<static> String
|
trim(<String> inString)
Trims unnecessary white space around the text within the element. |
<static> String
|
uscurrency(<Event> evt)
Called if this form element is supposed to be in the form of US currency (US dollars). |
<static> String
|
usdate(<Event> evt)
Called if this form element is a US formated date value (month-day-year). |
<static> String
|
usphone(<Event> evt)
Called if this form element is supposed to be a standard 10 digit US phone number (area code plus phone number). |
<static> String
|
zipcode(<Event> evt)
Called if this form element is supposed to be 5 digit or 9 digit zip code. This attribute will allow standard zip codes to be used such
as: Note: This attribute does not check to see if the zip code is a legitimate value, only that it is a legitimate format. |
| Method Detail |
<static> String alpha(<Event> evt)
Called if this form element can contain only letters. No numbers, or special symbols will be included.
Note: This will not make the entry requried. You must add that attribute to the form element as well if you require this form element to have a value.
evt - The event (usually onblur) which caused this function to be called.
<static> String alphanumeric(<Event> evt)
Called if this form element can contain only letters and numbers. No special characters or formatters are allowed.
Note: This will not make the entry requried. You must add that attribute to the form element as well if you require this form element to have a value.
evt - The event (usually onblur) which caused this function to be called.
<static> void autotrim(<Event> evt)
If we want the form element to auto trim the white space, we can set this attribute. Does not generate any error message - so safe for error checking if it is not a required field. ex.: autotrim="autotrim"
This method is good for eliminating unwanted spaced before usernames, passwords, and other fields which could eventually cause a problem if looking for a match.
evt - The event (usually onblur) which caused this function to be called.
<static> Boolean checkForm(<Object> frm)
frm - The form to be called. This method will validate the form when it is submitted, if it is manually placed in the onsubmit method.
Example:
This will check the form before it is submitted. Because return is used, if checkForm returns false, then it will not submit the form requiring the user to fix the errors before proceding.
This can also be attached to an onclick method of a button with some minor code tweaks to allow the user to confirm the correct data/ type of data had been entered. Should be unnecessary since the form is giving instaneous feedback as the form is being filled out.
<static> <private> String displayError(<Event> elem, <String> errType, <String> msg)
Error Information
This method only needs to be called from the other included
functions, however it is important enough to note here as it yeilds
information on how the error messages and classes are handled.
Displays the error based upon the status of the error checking. If frmCheck is set to true, no pop-ups are displayed.
Error messages can come from several sources:
Pop-Up Information
Additionally, you can set the popup attribute
(ex.: popop="only"). By doing so, when an error on that form field
occurs, it will cause the error message to display in a pop-up window.
Legal values for the popup attribute are: only and both. If
both is set, the error message will be displayed in both
the pop-up window, and an error box below the form element. If
the value only is set, only the pop-up window gets the error
message. This is a per field attribute setting.
CSS Style Information
Two CSS classes are used for defining error messages. You can
include the external CSS file provided, make changes, etc. The
classes are .errMsg and .errElem.
errMsg is used to display the error message box. errElem is for the
form element with the error. If these are not available, or made to
be blank, then the element recieving these classes will have no
additional style attached. The errElem is smartly applied and
removed so it will not effect any additional styles that have been
applied, unless it directly effects an associated attribute.
elem - - which element is getting the error message
errType - - what type of error - important for generating unique sections to hold the ID
msg - - the default error message.
<static> String email(<Event> evt)
This element must be a standard valid e-mail address. ex.: email="email"
evt - The event (usually onblur) which caused this function to be called.
<static> <private> String fixNaming(<String> inString)
Convert the humpBack notation into English readable for determining form element names.
inString - The string which should be "fixed" to convert from hump notation, or under_scored notation, into regular words for displaying error messages.
<static> DOMObject getTarget(<Event> evt)
Determine the target. If a Form element is passed, it is returned, if an Event is passed, the element that sent the event is returned, if nothing is passed (IE) then we get the last event, and determine which element generated that event.
evt - The event (usually onblur) which caused this function to be called. In some cases, this may also be the object itself. The method will handle this discrepancy.
<static> void initializeValidation()
Call this function after a the form(s) have been loaded and the appropriate tests will be attached to the onblur method of the form element.
<static> String internationaldate(<Event> evt)
Called if this form element is an international formated date value (year-month-day). Three seperators are supported including the slash, the dash, and the period. Use of the seperators must be consistant. The year may be in 2 digit or 4 digit format.
Note: This will not make the entry requried. You must add that attribute to the form element as well if you require this form element to have a value.
evt - The event (usually onblur) which caused this function to be called.
<static> String matches(<Event> evt)
The value of this form element must match another form element's, value. The form element to match against is the value of the matches attribute. ex.: matches="password" could be used on a confirm password field, that requires the passwords to match. The value in the attribute should be the form elements id. If the HTML document is well formed, this will keep the elements from potentially having the same name in two different forms.
Note: This will not make the entry requried. You must add that attribute to the form element as well if you require this form element to have a value. However, if the form element which this element is supposed to match, has the required attribute, then essentially this form element also gets that benifit because they two values must match.
evt - The event (usually onblur) which caused this function to be called.
<static> String maxlen(<Event> evt)
This element cannot have more than the number of charcters that the attribute value specifies. ex.: maxlen="300"
evt - The event (usually onblur) which caused this function to be called.
<static> String maxval(<Event> evt)
Called if this form element cannot be above the value specified within the value of the attribute. ex.: maxval="300" - then the contents of the text box cannot have a numeric value of over 300.
Additionally, the value in the textbox must consist of only numbers. The numeric function is automatically called with this function. This should make writting the attributes a little simpler. However, a value does not have to entered. So if the field is manditory, then it should have an attribute of required as well.
evt - The event (usually onblur) which caused this function to be called.
<static> String maxwords(<Event> evt)
Called if this form element cannot have more than a certain number of words. Sites requiring short answers, interview questions, etc would benifit from it availablity. ex.: maxwords="250" would keep any response more than 250 from progressing through.
Words are specified by being seperated with a space. Words seperated with new line characters, commas, and other values not associated with a space, will not be counted with this version. Future updates might allow for those functions to take place.
evt - The event (usually onblur) which caused this function to be called.
<static> Boolean meetsRegEx(<String> string, <String> regEx)
Determine if there was a match with the regular expression and the string.
string - The value that is to be checked against a regualr expression.
regEx - The regular expression that we will used
<static> String minlen(e)
This element must be at least n characters long as specified by the attribute value. ex.: minlen="6"
This attribute is good to use when you want to ensure a certain field, like a password is over a given length to make it more difficult to guess.
This has a similar effect to required, with the added bonus of ensuring that the field has a length over the specified number. If you wanted to use it as/instead of the required attribute, you could specify: minlen="1".
evt - The event (usually onblur) which caused this function to be called.
<static> String minval(<Event> evt)
The value of this form element cannot be below the value specified within the value of the attribute. ex.: minval="300" - then the contents of the text box cannot have a numeric value less than 300.
Additionally, the value in the textbox must consist of only numbers. The numeric function is automatically called with this function. This should make writting the attributes a little simpler. However, a value does not have to entered. So if the field is manditory, then it should have an attribute of required as well.
evt - The event (usually onblur) which caused this function to be called.
<static> <private> Boolean myAttachEvent(<DOMObject> obj,<Event> evt,<Function> func)
Attached a function to an event for a given object. Checks to make sure it can be done for different browsers.
This presents a unified method of adding the function as the event handler, and abstracts this level so the same code is not repeated over and over.
obj -
evt - The event (usually onblur) which caused this function to be called.
func -
<static> String notfirst(<Event> evt)
Called if this form element, a drop down element or a list box, is not the first element as the selected element. ex.: notfirst="notfirst"
This attribute is only effective for llist boxes and drop-down menus. (i.e. the select tag)
evt - The event (usually onblur) which caused this function to be called.
<static> String numeric(<Event> evt)
Called if this form element can contain only numbers. No letters, or special symbols will be included. A single decimal place is allowed to seperate the space between the whole number and the decimal, value, however, the comma, used to group numbers, is not allowed, nor is the period allowed to group numbers.
Note: This will not make the entry requried. You must add that attribute to the form element as well if you require this form element to have a value.
evt - The event (usually onblur) which caused this function to be called.
<static> String numgt(<Event> evt)
The number in the given field must be larger than the field associated as the value in the attribute numgt.
Note: This will not make the entry requried. You must add that attribute to the form element as well if you require this form element to have a value. However, if the form element which this element is supposed to match, has the required attribute, then essentially this form element also gets that benifit because they two values must match.
evt - The event (usually onblur) which caused this function to be called.
<static> String numgte(<Event> evt)
The number in the given field must be larger than or equal to the field associated as the value in the attribute numgt.
Note: This will not make the entry requried. You must add that attribute to the form element as well if you require this form element to have a value. However, if the form element which this element is supposed to match, has the required attribute, then essentially this form element also gets that benifit because they two values must match.
evt - The event (usually onblur) which caused this function to be called.
<static> String regex(<Event> evt)
Called if this form element must match a regular expression. The regular expression to be matched is the value within the attribute regex.
This feature was added incase any potential areas that were not covered by the built in expresssions were needed. With this attribute those circumstances could be covered. This might include things like product serial numbers, library card values, et cetera.
evt - The event (usually onblur) which caused this function to be called.
<static> <private> void removeErrorNode(<DOMObject> elem, <String> errType)
If the error has been resolved, it will remove the error node and reset any styles.
elem -
errType -
<static> String required(<Event> evt)
This element cannot be left blank. ex.: required="true"
evt - The event (usually onblur) which caused this function to be called.
<static> String ssn(<Event> evt)
This attribute is used to check to see that the form element is using a SSN format. It will support dashes or spaces between the number groupings, as well as leaving them out. ex.: ssn="ssn"
This attribute will allows for:
123-45-6789
123 45 6789
123456789
Note: This attribute does not check to see if theSSN is valid for a living individual, only that it is a legitimate format.
evt - The event (usually onblur) which caused this function to be called.
<static> String time(<Event> evt)
Called if this form element is a time value of hours and minutes.
This attribute will allows for:
9:45
9:45 am
9:45 AM
This formating does not allow for 24 hour time telling, sometimes called "Military Format". It also does not allow for time zones to be included with the time. Given the number of time zones (there are more than 24 depending upon country location) it would be impractical to include that information. Likewise, most people do not know their +/- GMT value, so it is not valid for this time pattern.
evt - The event (usually onblur) which caused this function to be called.
<static> String trim(<String> inString)
Trims unnecessary white space around the text within the element. This is a private method that should not be needed except by other functions within this library.
inString -
<static> String uscurrency(<Event> evt)
Called if this form element is supposed to be in the form of US currency (US dollars). This does not allow for commas for thousand places, but does require the decimal and two digits for the cents. The dollar sign is also required for the start of the value. ex.: uscurrency="uscurrency"
This attribute will allows for:
$123.45
$0.99
evt - The event (usually onblur) which caused this function to be called.
<static> String usdate(<Event> evt)
Called if this form element is a US formated date value (month-day-year). Two seperators are supported including the slash and the dash. Use of the seperators must be consistant.
This attribute will allows for:
6/7/2007
06/7/2007
6/07/2007
06/07/2007
6/7/07
06/07/07
et cetra. Dashes may also replace the slashes.
evt - The event (usually onblur) which caused this function to be called.
<static> String usphone(<Event> evt)
Called if this form element is supposed to be a standard 10 digit US phone number (area code plus phone number). It will accept numbers and seperators only, so vanity phone numbers ex.: (800) my-teeth, will not validate. ex.: usphone="usphone".
This attribute will allow standard phone numbers to be used such
as:
407-555-1234
407.555.1234
407 555 1234
(407)555-1234
(407) 555-1234
Note: This attribute does not check to see if the phone number is a legitimate value, only that it is a legitimate format. i.e. someone could enter 407-555-1234, which is not legal, but in the correct format.
evt - The event (usually onblur) which caused this function to be called.
<static> String zipcode(<Event> evt)
Called if this form element is supposed to be 5 digit or 9 digit zip code.
This attribute will allow standard zip codes to be used such
as:
32712
32712-1234
Note: This attribute does not check to see if the zip code is a legitimate value, only that it is a legitimate format.
evt - The event (usually onblur) which caused this function to be called.