//Form Validation Functions: function jsIsEmailValid(vFormName,vElementName) {
var vValue = ''
var vValid = false
var vElement = document.forms[vFormName].elements[vElementName]
var vPosAtSymbol = vElement.value.indexOf('@')
var vPosPeriod = vElement.value.lastIndexOf('.')
var vPosSpace = vElement.value.indexOf(' ')
var vLength = vElement.value.length - 1
if (
// '@' in first position
(vPosAtSymbol < 1) ||
// '@' in last position
(vPosAtSymbol == vLength) ||
// Not at least one valid char' between '@' and '.'
(vElement.value.charAt(vPosAtSymbol + 1) == '.' ) ||
(vElement.value.charAt(vPosAtSymbol - 1) == '.' ) ||
// Must be at least two valid char's after last '.'
(vPosPeriod >= vLength - 1) ||
// No space char's permitted
(vPosSpace != -1)
) {
vValue = 'Please enter a valid e-mail address.'
+ '\\n\\nSample: YourName@aol.com'
window.alert(vValue)
vElement.focus()
return vValid
}
vValid = true
return vValid
}
function jsIsNotComplete(vElement, vMsg) { if (vElement.value == '' ) { vValue = 'Please complete the following:\\n\\n ' + vMsg window.alert(vValue) vElement.focus() return true } else { return false } }
function jsIsNotSelected(vElement, vMsg) { if (vElement.selectedIndex == 0 ) { vValue = 'Please complete the following:\\n\\n ' + vMsg window.alert(vValue) vElement.focus() return true } else { return false } }
function jsIsPasswordValid(vElement1, vElement2) { if (vElement1.value == '' || vElement2.value == '') return false
if (vElement1.value == vElement2.value ) {
return true
}
else {
window.alert('Please enter a valid password.')
vElement1.focus()
return false
}
}