I was able to solve my issue with error handling on the Aruba Controller Custom Captive Portal. Below is a very basic working sample I used on a Aruba 7030 controller running 6.4.2.4 code.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Wireless Authentication</title>
<STYLE type=text/css>
body{
margin-top:10px;
padding:0px;
font-family: Arial;
background-color: #A4A4A4;
color:#444444;
}
#container{
padding-top:10px;
margin-top:20px;
text-align:center;
width: 80%;
margin-left:auto;
margin-right:auto;
}
#errorbox{
color:#FFFFFF;
background-color:red;
padding:3px;
margin-left:auto;
margin-right:auto;
width: 80%;
}
h1{
font-size: 48px;
margin-left:7px;
margin-right:7px;
margin-top:5px;
margin-bottom:5px;
padding-bottom:5px;
padding-top:5px;
color:#FFFFFF;
}
</style>
<script language="javascript" type="text/javascript">
function errorcheck(url){
var errormessage = "None";
org_url = url;
if(url.search(/errmsg=Authentication%20failed/i)>0) {
errormessage = "Login failed, please check your details and try again";
}else if (url.search(/errmsg=Access%20denied/i)>0) {
errormessage = "Access Denied, please check your details and try again";
}else if (url.search(/errmsg=/i)>0) {
errormessage = org_url.match(/(errmsg=.*?&)|(errmsg=.*$)/i)[0];
errormessage = errormessage.replace(/(errmsg=)|&/g,"");
errormessage = errormessage.replace(/%20/g," ");
}else{
errormessage = "None";
}
return errormessage;
}
</script>
</head>
<body>
<div id="container" >
<div id="title"><H1>Company WiFi</H1></div>
<p>Enter your username and password to connect to the wireless network.</p>
<form ACTION="/auth/index.html/u id="regform" method="post" autocomplete="off" title="Form used by registered users to login">
<script>
errormessage = errorcheck(document.URL);
if(errormessage != "None"){
error = "<div id='errorbox'>
"+ errormessage + "
</div>
" + "<br />";
document.write(error);
}
</script>
Username
<br/>
<input type="text" name="user" id="user" size="30" class="text" accesskey="u" />
<br />
<br />
Password
<br/>
<input id="password" name="password" type="password" size="30" class="text" accesskey="p" />
<br />
<br />
<input type="hidden" name="cmd" value="authenticate" />
<input type="submit" name="Login" value="Log In" class="button" />
<br />
<br />
By clicking the login button you are explicitly accepting the usage agreement.
</form>
</div>
</body>
</html>