Ok I am currently working on a mobile website for my company. The issue I am having is with my javascript that allows a person to sign up for a free 7 day trail. When I debug the app everything works fine until I hit enter the name and either a phone number of email. It gives me my custom errors saying that there is no name and the phone or email is invalid. But if I just refresh the page it works fine. Below the code any help would be great.

// file names for mobile site pages
var PAGE_INDEX = "/Mobile/Index", PAGE_CLUBS = "/Mobile/FindClub", PAGE_PASS = "/Mobile/GetPass", PAGE_CONFIRM = "/Mobile/Confirm";

$(document).ready(function () {

// zip entry form functionality
// select contents on focus
$("#zipEntry").live("focus", function () {
$(this).select();
});

// validate entry for submit
$("form#enterZipForm").submit(function () {
var zipVal = $("#zipEntry").val(), validationMsg;

// if 9 digit, reformat 9 digit to include dash
if (/^\d{9}$/.test(zipVal)) {
zipVal = zipVal.substr(0, 5) + "-" + zipVal.substr(5, 4);
}

if (/(^\d{5}$)|(^\d{5}-\d{4}$)/.test(zipVal)) {
return true;
}
else {
validationMsg = "Please enter a valid zip code.";
alert(validationMsg);
return false;
}

});

// manage page changes
$("div.ui-page").live("pagebeforeshow", function () {
var pageId = $(this).attr("id");

// clear title text
$("#pageTitle").html("");

// show / hide home button
if ((pageId == "pageMain") || (pageId == PAGE_INDEX)) {
$("#navHome").hide();
}
else {
$("#navHome").show();
}

// show blurb for find clubs from get pass button
$(".getPassBlurb").hide();

if ((pageId == PAGE_CLUBS) || (pageId == "pageFindClubs")) {
if (((new String(window.location)).indexOf("target=getPass") != -1) || ($(".navTarget").val() == "getPass")) {
$(".getPassBlurb").show();
}
}
});

$("div.ui-page").live("pageshow", function () {
// variable declaration
var es, pageId = $(this).attr("id");

// display correct toolbar + retitle page
$(".toolbar").hide();

switch (pageId) {
case "pageGetPass":
case PAGE_PASS:
$("#toolbarGetPass").show();
break;
case "pageConfirm":
case PAGE_CONFIRM:
$("#toolbarConfirmed").show();
break;
default:
$("#toolbarFindClubs").show();
break;
}

// synch language link
// es = isSpanish();
// $("#navLanguage").attr("href", es ? "?culture=en" : "?culture=es").html( es ? "Bally In English" : "Bally En Español" );

// switch club links to form submits by scrubbing direct links
if ($(".clubOption a").attr("rel") != "external") {
$(".clubOption a").attr("href", "#");
}

// when find clubs page is created, make adjustments for correct presentation

// fix link for confirm page to target existing index page div
enableHomeBackup("#navGoHome");
});

// set up select club and navigation form submissions
$(".clubOptionLink").live("click", function () {
$("#clubid").val($(this).attr("id"));
$("#getPassForm").submit();
});

// set up select club and navigation form submissions
$("#navGetGuestPass").click("click", function () {
$("#target").val('getPass');
$("#findClubsGeoCode").submit();
});

// set up select club and navigation form submissions
$("#navFindAClub").click("click", function () {
$("#target").val('findClubs');
$("#findClubsGeoCode").submit();
});

$("#fullLink").click("click", function () {
if (confirm("You are about to be switched from the mobile website to the full website. Do you wish to proceed?")) {
return true;
}
else {
return false;
}
});

// when get pass form page is created, make adjustments for correct presentation
$("div.ui-page").live("pagecreate", function () {
// When findClubs page is loaded, move get Free Pass into link
if ($("a.clubOptionLink").length > 0) {
$("li.clubOption").each(function () {
var promptTxt = $("a.clubOptionLink", this).siblings("div.clubLinkPrompt").detach();
var promptLink = $("a.clubOptionLink", this);
promptLink.html("");
promptLink.append(promptTxt);
});
}
// create hidden value for storing phone or e-mail selection for Get Pass Page
if (($(this).attr("id") == PAGE_PASS) || ($(this).attr("id") == "pageGetPass")) {
$("form#sendPassForm #selectContactType").html("<input name=\"contactType\" id=\"contactType\" value=\"phone\" type=\"HIDDEN\" />");
}
// set zip entry width to properly align zip entry for all other pages
else {
$(".toolbar").hide();
$("#toolbarFindClubs").show();

$(".centerZip").width($("h3.zipLabel").width() + $("#enterZipArea").width() + parseInt($("h3.zipLabel").css("margin-left")) + parseInt($("h3.zipLabel").css("margin-right")) + parseInt($("#enterZipArea").css("margin-left")) + parseInt($("#enterZipArea").css("margin-right")) + 1);
}

// create refresh-enforcing main menu navigation
if (($(this).attr("id") == PAGE_INDEX) || ($(this).attr("id") == "pageMain")) {
// scrub links for menu
$("#mainLinkList a").attr("href", "#");

// create the navigation form
$(this).append("<form id=\"navForm\" action=\"\" method=\"GET\"><input type=\"HIDDEN\" name=\"target\" value=\"\" class=\"navTarget\" /></form>");

// create form submission navigation for links
$("#navFindAClub").click(function () {
$(".navTarget").val("findClubs");
navByFormTo(PAGE_CLUBS);
return false;
});

$("#navGetGuestPass").click(function () {
$(".navTarget").val("getPass");
navByFormTo(PAGE_CLUBS);
return false;
});
}

// validate for guest pass request
$("form#sendPassForm").submit(function () {
var validationMsg = "";

if ($("#firstName").val().replace(/\s/g, "") == "") {
validationMsg += "Please enter a first name.\n";
}
else {
if (!$("#firstName").val().match(/^(\s*[A-Za-z]+\.?(?:[-|\s]+[A-Za-z]+\.?)*\s*){2}$/)) {
validationMsg += "First Name is invalid.\n";
}
}

if ($("#lastName").val().replace(/\s/g, "") == "") {
validationMsg += "Please enter a last name.\n";
}
else {
if (!$("#lastName").val().match(/^(\s*[A-Za-z]+\.?(?:[-|\s|']+[A-Za-z]+\.?)*\s*){2}$/)) {
validationMsg += "Last Name is invalid.\n";
}
}

if ($("#contactType").val() == "phone") {
// reformat phone number to correct format ( no (s,)s,-s, or spaces )
$("#phone").val($("#phone").val().replace(/(-)|(\()|(\))|(\s)/g, ""));

// validate
if (!(/^\d{10}$/.test($("#phone").val()))) { validationMsg += "Mobile Phone Number is invalid\n"; }
}
else {
if (!(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/.test($("#email").val()))) {
validationMsg += "Please enter a valid email address.\n";
}
}

if (validationMsg != "") {
alert(validationMsg);
return false;
}
else {
return true;
}
});
});
$("#contactRadioPhone, #contactRadioEmail").live("click", function () { selectContactRadio($(this)); });
$("#email, #phone").live("keydown", function () {
if ($(this).attr("id") == "email") { selectContactRadio($("#contactRadioEmail")); }
else if ($(this).attr("id") == "phone") { selectContactRadio($("#contactRadioPhone")); }
});

// replace home link with backup functionality
enableHomeBackup("#navHome");

});

// update custom radio button images and form input value function
function selectContactRadio(radioObj) {
$("#contactRadioPhone, #contactRadioEmail").removeClass("radioSelected").addClass("radioDeselected");
radioObj.removeClass("radioDeselected").addClass("radioSelected");
if (radioObj.attr("id") == "contactRadioPhone") { $("#contactType").val("phone"); }
else { $("#contactType").val("email"); }
}

// use a form submission strategy to demand a page refresh
function navByFormTo(url) {
var navFrm = $("form#navForm");
navFrm.attr("action", url);
navFrm.submit();
}

// check for Spanish language preference
//function isSpanish()
//{
// if ( (new String(window.location)).indexOf("culture=es") != -1 ) return true;
// else return false;
//}

function enableHomeBackup(selector) {
$(selector).attr("href", "#");
$(selector).click(function () { $.mobile.changePage(($("#pageMain").length != 0) ? "#pageMain" : PAGE_INDEX, "slide", true, true); });
}