Sample Page – Single Event
function checkInternationalPhone(strPhone){
// Declaring required variables
var digits = “0123456789″;
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = “()- “;
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + “+”;
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 10;
function isInteger(s)
{ var i;
for (i = 0; i < s.length; i++)
{
// Check that current character is number.
var c = s.charAt(i);
if (((c < "0") || (c > “9″))) return false;
}
// All characters are numbers.
return true;
}
function trim(s)
{ var i;
var returnString = “”;
// Search through string’s characters one by one.
// If character is not a whitespace, append to returnString.
for (i = 0; i < s.length; i++)
{
// Check that current character isn’t whitespace.
var c = s.charAt(i);
if (c != ” “) returnString += c;
}
return returnString;
}
function stripCharsInBag(s, bag)
{ var i;
var returnString = “”;
// Search through string’s characters one by one.
// If character is not in bag, append to returnString.
for (i = 0; i < s.length; i++)
{
// Check that current character isn’t whitespace.
var c = s.charAt(i);
if (bag.indexOf(c) == -1) returnString += c;
}
return returnString;
}
var bracket=3
strPhone=trim(strPhone)
if(strPhone.indexOf(“+”)>1) return false
if(strPhone.indexOf(“-”)!=-1)bracket=bracket+1
if(strPhone.indexOf(“(“)!=-1 && strPhone.indexOf(“(“)>bracket)return false
var brchr=strPhone.indexOf(“(“)
if(strPhone.indexOf(“(“)!=-1 && strPhone.charAt(brchr+2)!=”)”)return false
if(strPhone.indexOf(“(“)==-1 && strPhone.indexOf(“)”)!=-1)return false
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}
function echeck(str) {
var at=”@”
var dot=”.”
var em = “”
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if (str.indexOf(at)==-1){
return false;
}
if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
return false;
}
if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
return false;
}
if (str.indexOf(at,(lat+1))!=-1){
return false;
}
if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
return false;
}
if (str.indexOf(dot,(lat+2))==-1){
return false;
}
if (str.indexOf(” “)!=-1){
return false;
}
return true;
}
function testIsValidObject(objToTest) {
if (objToTest == null || objToTest == undefined) {
return false;
}
return true;
}
function jcap(){
var uword = hex_md5(document.getElementById(jfldid).value);
if (uword==cword[anum-1]) {
return true;
}
else {
return false;
}
}
function validateForm(form) {
var msg = “”;
if (form.fname.value == “”) { msg += “\n ” +”Please enter your first name.”;
form.fname.focus( );
}
if (form.lname.value == “”) { msg += “\n ” +”Please enter your last name.”;
form.lname.focus( );
}
if (echeck(form.email.value)==false){
msg += “\n ” + “Email format not correct!”;
}
if(form.phone) {
if (form.phone.value == “” || form.phone.value==null) { msg += “\n ” +”Please enter your phone number.”;
form.phone.focus( );
}
if (checkInternationalPhone(form.phone.value)==false){
msg += “\n ” +”Please use correct format for your phone number.”;
form.value=”"
form.phone.focus()
}
}
if(form.address) {
if (form.address.value == “”) { msg += “\n ” +”Please enter your address.”;
form.address.focus( );
}
}
if(form.city) {
if (form.city.value == “”) { msg += “\n ” +”Please enter your city.”;
form.city.focus( );
} }
if(form.state) {
if (form.state.value == “”) { msg += “\n ” + “Please enter your state.”;
form.state.focus( );
}
}
if(form.zip) {
if (form.zip.value == “”) { msg += “\n ” +”Please enter your zip code.”;
form.zip.focus( );
}
}
//Validate Extra Questions
function trim(s) {if (s) {return s.replace(/^\s*|\s*$/g,”");} return null;}
var inputs = form.getElementsByTagName(“input”);
var e;
//Start Extra Questions Check
for( var i = 0, e; e = inputs[i]; i++ )
{
var value = e.value ? trim(e.value) : null;
if (e.type == “text” && e.title && !value && e.className == “r”)
{msg += “\n ” + e.title;}
if ((e.type == “radio” || e.type == “checkbox”) && e.className == “r”) {
var rd =”"
var controls = form.elements;
function getSelectedControl(group)
{
for (var i = 0, n = group.length; i < n; ++i)
if (group[i].checked) return group[i];
return null;
}
if (!getSelectedControl(controls[e.name]))
{msg += “\n ” + e.title;}
}
}
var inputs = form.getElementsByTagName(“textarea”);
var e;
//Start Extra TextArea Questions Check
for( var i = 0, e; e = inputs[i]; i++ )
{
var value = e.value ? trim(e.value) : null;
if (!value && e.className == “r”)
{msg += “\n ” + e.title;}
}
var inputs = form.getElementsByTagName(“select”);
var e;
//Start Extra TextArea Questions Check
for( var i = 0, e; e = inputs[i]; i++ )
{
var value = e.value ? trim(e.value) : null;
if ((!value || value ==”) && e.className == “r”)
{msg += “\n ” + e.title;}
}
if (msg.length > 0) {
msg = “The following fields need to be completed before you can submit.\n\n” + msg;
alert(msg);
if (document.getElementById(“mySubmit”).disabled==true){
document.getElementById(“mySubmit”).disabled=false;}
document.getElementById(“mySubmit”).focus( );
return false;
}
return true;
}
Event Registration for –
| – FREE EVENT |
