Domino Code Fragment

Code Name*
JavaScript alertBox function
Date*
04/19/2000
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.
Description*
This relatively simple alertBox function presents the user with a specified message and places the cursor back into the field that failed the validation.
Type*
JavaScript
Categories*
User Interface (Web)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:

function alertBox (vField, vMessage, vType ) {

//this function replaces the spaces in a string with the provided character

//if we pass a null message, we are doing a multiple validation test. return
so we can check other conditions.
if ( vMessage == "null" ) return;


//otherwise, display the error message
alert ( "Field Contains Incorrect Value:\n\n" + vMessage )


//and set focus (plus select the text if a text element)
if ( vType == "text" ) {


vField.focus();

vField.select();

} else {

vField.focus();

}

return;

}