Here is the JS code. I have removed a bunch of Validation rules to
shorten it up. The code at the bottom is the problem.

$(document).ready(function(){
   $("#employmentForm").validate({
                debug: false,

                rules: {
                        emp_applicationDate: {
                                required: true,
                                minlength: 2
                        }

                }, //End of rules section

                messages: {
                        emp_termsAgreed: {
                                minlength: "You must agree to the Terms and 
Conditions above to
submit."
                        }//End of emp_termsAgreed section
                }//End of Messages section


        });//End of form validation


        //Show the detail for each control that has "Query" on the end of the
name.
        $("[name$='Query']").click(function(){
                if($(this).val() == "Yes"){
                        $("[name='"+$(this).attr("name")+"Yes']").slideDown();
                        $("[name='"+$(this).attr("name")+"No']").slideUp();
                }else{
                        $("[name='"+$(this).attr("name")+"Yes']").slideUp();
                        $("[name='"+$(this).attr("name")+"No']").slideDown();
                }
        });


        $("[name$='Query']").each(function(){
                        $("[name='"+$(this).attr("name")+"Yes']").hide();
                        $("[name='"+$(this).attr("name")+"No']").hide();
        });

        /*Hide all detail sections - to do this we need to check their value
first.
        It is possible that they have already been checked and the page was
just refreshed.
        To deal with this we need to close all the detail areas first and
then show the
        detail areas that are checked "yes".
        */


        $("[name$='Query']").each(function(){
                if ($(this).attr("checked") == true && $(this).attr("value") ==
"Yes" ){
                        $("[name='"+$(this).attr("name")+"Yes']").show();
                        $("[name='"+$(this).attr("name")+"No']").hide();
                }
                if ($(this).attr("checked") == true && $(this).attr("value") ==
"No" ){
                        $("[name='"+$(this).attr("name")+"Yes']").hide();
                        $("[name='"+$(this).attr("name")+"No']").show();
                }
        });



//Build names for signature

$("[name^='emp_name']").blur(function () {
      $("#namePrompt").text("Example: "+$("[name='emp_nameLast']").val
());
var middleName = $("[name='emp_nameMiddle']").val();
if (middleName.length > 0){
      $("#namePrompt").text("Ex: "+$("[name='emp_nameFirst']").val()+"
"+$("[name='emp_nameMiddle']").val()+" "+$("[name='emp_nameLast']").val
());
}else{
      $("#namePrompt").text("Ex: "+$("[name='emp_nameFirst']").val()+"
"+$("[name='emp_nameLast']").val());
}
});

jQuery.validator.addMethod( "testvalue",
function(value, params) {
   if (params.checked){
      return true;
   }else{
      return false;
   }
 }, "It is required that you read and agree to the Terms and Agreement
above before submitting your application.");

});//End of document ready function

function confSubmit(form) {
if (confirm("Are you sure you want to submit the form?")) {
   $("#employmentForm").submit();
}else{
   return false;
}

}//End of confSubmit function

Reply via email to