/* -----------------------------------------------------------------------------
*
* File: /scripts/subscribe.js
* Project: WaveTrack Website
* Author: Dominique Kraus-Ahma -
* Kraus-Ahma IT Consulting (dka@kraus-ahma.com)
* Purpose: This script provides all javascript callbacks for the 'Subscription' template
* History: 15.01.2011 14:06:49 - file created (dk@)
*
* NOTES:
*
----------------------------------------------------------------------------- */
// ---- checking form field data for step: 'BASIC'
//
function checkLoginData(){
var objForm = document.forms[ 'frmDefaultLogin' ];
var aPosMsg = new Array();
var aErrMessages = new Array();
var szMsgString = '
';
if( "" != objForm.txtAccountName.value ){
var element = objForm.txtAccountName;
var re = /[\w\d]/;
if( !re.test( element.value ) ){
aErrMessages.push( "txtAccountName#" + "Your account contains invalid characters!" );
} else {
aPosMsg.push( "txtAccountName" );
} // if( !re.test( element.value ) )
} else {
aErrMessages.push( "txtAccountName#" + "Please insert your account name!" );
} // if( "" != objForm.txtAccountName.value )
if( "" != objForm.txtAccountPasswd.value ){
var element = objForm.txtAccountPasswd;
var re = /[\w\d]/;
if( !re.test( element.value ) ){
aErrMessages.push( "txtAccountPasswd#" + "Your password invalid characters!" );
} else {
aPosMsg.push( "txtAccountPasswd" );
} // if( !re.test( element.value ) )
} else {
aErrMessages.push( "txtAccountPasswd#" + "Please insert your password!" );
} // if( "" != objForm.txtAccountPasswd.value )
for( var idx = 0; idx < aPosMsg.length; idx++ ){
if( null != document.getElementById( aPosMsg[ idx ] ) ){
document.getElementById( aPosMsg[ idx ] ).style.border = "1px solid #ccc";
} // if( null != document.getElementById( aPosMsg[ idx ] ) )
//document.getElementById( aPosMsg[ idx ] + "Msg" ).innerHTML = "";
} // for( var idx = 0; idx < aPosMsg.length; idx++ )
if( aErrMessages.length > 0 ){
for( var idx = 0; idx < aErrMessages.length; idx++ ){
aErrorMsg = aErrMessages[ idx ].split( "#" );
if( null != document.getElementById( aErrorMsg[ 0 ] ) ){
document.getElementById( aErrorMsg[ 0 ] ).style.border = "1px solid #a70000";
szMsgString = szMsgString + '- ' + aErrorMsg[ 1 ] + '
- ';
} // if( null != document.getElementById( aErrorMsg[ idx ] ) )
} // for( var idx = 0; idx < aErrMessages.length; idx++ )
showErrorMsg( szMsgString + '
' );
return( false );
} // if( aErrMessages.length > 0 )
return( true );
} // function 'checkLoginData()'.
$( document ).ready(
function(){
/* -------------------------------------------------------------------------- */
$( '#btnDefaultLogin' ).live( 'click',
function( oEvent ){
oEvent.preventDefault();
if( true == checkLoginData() ){
$( '#frmDefaultLogin' ).submit();
}
}
);
/* -------------------------------------------------------------------------- */
}
);