Change JS alert to DOM error message div
- by Jason
I need to convert my error messaging to a positioned div (hidden initially) instead of the standard js alert. I realize I need to push the alert message to the DOM, but I'm new to javascript. Any help would be appreciated.
Additionally, I need to do it without a confirm (so error message removes on field focus)
if(el != null) {
switch(el.name) {
case "firstName":
//First Name Field Validation, Return false if field is empty
if( f.firstName.value == "" )
{
alert( bnadd_msg_002 );
if ((typeof TeaLeaf != "undefined") && (typeof TeaLeaf.Client != "undefined") && (typeof TeaLeaf.Client.tlAddEvent != "undefined") ) {
var nVO = { ErrorMessage : bnadd_msg_002}
var subtype="CustomErrorMsg";
TeaLeaf.Event.tlAddCustomEvent(subtype, nVO);
}
return false;
}
break;