Click here to Skip to main content
15,882,464 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionweb app startup page Pin
classy_dog3-May-12 17:27
classy_dog3-May-12 17:27 
AnswerRe: web app startup page Pin
egenis3-May-12 18:41
egenis3-May-12 18:41 
QuestionFire Validation Summary in textbox blur Pin
indian1433-May-12 8:03
indian1433-May-12 8:03 
AnswerRe: Fire Validation Summary in textbox blur Pin
R. Giskard Reventlov3-May-12 9:34
R. Giskard Reventlov3-May-12 9:34 
AnswerRe: Fire Validation Summary in textbox blur Pin
Joshua Omundson3-May-12 9:44
Joshua Omundson3-May-12 9:44 
QuestionJquery Run Time Error: jquey.validator Pin
indian1433-May-12 5:04
indian1433-May-12 5:04 
AnswerRe: Jquery Run Time Error: jquey.validator Pin
jkirkerx3-May-12 7:03
professionaljkirkerx3-May-12 7:03 
GeneralRe: Jquery Run Time Error: jquey.validator Pin
indian1433-May-12 13:58
indian1433-May-12 13:58 
Hi,

Here is the code that I used in jquery, it is giving error at jquery.validate.creditcard2.js, saying jquery.validate is null, when I commented that script tag completely, it was giving me error like object not found. And I am using update panel for the whole content page.

Is there any help that anybody can give me, really really am in need and am new for the jquery technology.

 <script type="text/javascript" src="../../Scripts/jquery-1.7.1.js"></script>    
    <script type="text/javascript" src="../../Script/Payment.js"></script>
<script type="text/javascript" src="../../Scripts/jquery.validate.creditcard2.js"></script>

 <script type="text/javascript">
$.fn.paymentpagevalidation = function() {
        var cardholdernameValid = false;
        var confirmationValid = false; 

                        $(function ($) {
        $("#cardnum").ForceNumericOnly();
    });

                            $(function ($) {
        $("#ccMonth").ForceNumericOnly();
    });
    
                                $(function ($) {
        $("#ccYear").ForceNumericOnly();
    });

                                $(function ($) {
        $("#securityCode").ForceNumericOnly();
    });
      
       $('.validationGroup .causesValidation').click(function (evt) {

    // Ascend from the button that triggered this click event 
    //  until we find a container element flagged with 
    //  .validationGroup and store a reference to that element.
    var $group = $(this).parents('.validationGroup');
 
    var isValid = true;
 
    // Descending from that .validationGroup element, find any input
    //  elements within it, iterate over them, and run validation on 
    //  each of them.
    $group.find(':input').each(function (i, item) {

    if($(item)[0].id != "")
    {  
      if($(item)[0].id != "address2")
      {
          if (!$(item).valid())
          {
            isValid = false;
          }
      }
    }
  });
 
    if (!isValid)
      evt.preventDefault();
  });

$.validator.addMethod("dropDownValidator", function (value, element, parameters) {         
if (value == '-1'){
return false;
}
else
return true;
});          

$.validator.addMethod("monthValidator", function (value, element, parameters) {         
if ((value < 1) || (value > 12)){
return false;
}
else if((value >= 1) || (value <= 12)){
return true;
}
else{
return false;
}
}); 

$("#securityCode").click(function () {    
    if($("#rblPaymentType input[type=radio]:checked").val()=="AmEx")
    {
        $("#securityCode").attr('maxlength','4'); 
    }
    else
    {
        $("#securityCode").attr('maxlength','3'); 
    }
});

$.validator.addMethod("securityCodeValidator", function (value, element, parameters) {         
    if($("#rblPaymentType input[type=radio]:checked").val()=="AmEx")
    {
        if($("#securityCode").val().length == 4)
        {
            return true;
        }
        else
        {
          return false;
        }
    }
    else
    {
        if($("#securityCode").val().length == 3)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
});     
                       
        $('#form').validate({       
           
            rules: {
                 <%= cardholdername.UniqueID %>: {
                    required: true,
                    minlength: 1
                },
                 <%= address1.UniqueID %>: {
                    required: true,
                    minlength: 1
                },
                 <%= city.UniqueID %>: {
                    required: true,
                    minlength: 1
                },
                 <%= postcode.UniqueID %>: {
                    required: true
                },
                 <%= ccMonth.UniqueID %>: {
                    required: true,
                    minlength: 2,                   
                    number: true,
                    monthValidator: true                  
                },
                 <%= ccYear.UniqueID %>: {
                    required: true,
                    minlength: 2,
                    number: true
                },
                 <%= securityCode.UniqueID %>: {
                    required: true,
                    minlength: 3,
                    number: true,
                    securityCodeValidator: true
                },
                <%= rblPaymentType.UniqueID %>: {
                    required: true
                },
                <%= cardnum.UniqueID %>: {
                required: true,
                number: true
                },
                <%= ddlCountry.UniqueID %>: 
                {                                         
                    dropDownValidator: true                 
                },
                <%= ddlState.UniqueID %>: 
                {                                         
                    dropDownValidator: true                 
                }
            },
            messages: {
                <%= cardholdername.UniqueID %>: {
                    required: "Please provide your Cardholder Name",
                    minlength: "Your Cardholder Name must be at least 1 characters long" 
                },
                <%= address1.UniqueID %>: {
                    required: "Please provide your Address1",
                    minlength: "Your Address1 must be at least 1 characters long" 
                },
                <%= city.UniqueID %>: {
                    required: "Please provide your City",
                    minlength: "Your City Number be at least 1 characters long" 
                },

                <%= postcode.UniqueID %>: {
                    required: "Please provide your Postal Code"
                },
                <%= rblPaymentType.UniqueID %>: {
                    required: "Please select Credit Card Type"
                },
                <%= ccMonth.UniqueID %>: {
                    required: "Please confirm your Credit Card Month",
                    minlength: "Your Credit Card Month must be at least 2 digits long",
                    number: "Provide only digits for the month",
                    monthValidator: "Invalid Month"                 
                },
                <%= ccYear.UniqueID %>: {
                    required: "Please confirm your Credit Card Year",
                    minlength: "Your Credit Card Year must be at least 2 digits long",
                    number: "Provide only digits for the year"
                },
                <%= securityCode.UniqueID %>: {
                    required: "Please confirm your Security Code",
                    minlength: "Your Security Code must be at least 3 digits long",
                    number: "Provide only digits for the security code",
                    securityCodeValidator: "Please provide 4 digits for AmEx card"
                },
                <%= cardnum.UniqueID %>: {
                    required: "Please enter your Credit Card number",
                    number: "Provide only digits for the credit card number"
                },
                <%= ddlCountry.UniqueID %>: {
                dropDownValidator: "Please Select Country"
                },
                <%= ddlState.UniqueID %>: {
                dropDownValidator: "Please Select State"
                }
            },
            errorElement: "li",
            errorLabelContainer: "#errorMessage",
            onsubmit: false

        });

        //validate on change

        $("#cardholdername").blur(function () {       
            var elemTest = $("#cardholdername").valid();
        });

        $("#address1").blur(function () {
            var elemTest = $("#address1").valid();
        });

         $("#city").blur(function () {
            var elemTest = $("#city").valid();
        });

        $("#ddlState").blur(function () {
            var elemTest = $("#ddlState").valid();
        });

        $("#ddlCountry").blur(function () {
            var elemTest = $("#ddlCountry").valid();
        });

        $("#postcode").blur(function () {
            var elemTest = $("#postcode").valid();
        });

        $("#ccMonth").blur(function () {
            var elemTest = $("#ccMonth").valid();                                  
        });

        $("#ccYear").blur(function () {
            var elemTest = $("#ccYear").valid();
        });

        $("#securityCode").blur(function () {
            var elemTest = $("#securityCode").valid();
        });

        $("#rblPaymentType").blur(function () {
            var elemTest = $("#rblPaymentType").valid();
        });

        $("#cardnum").blur(function () {
            var elemTest = $("#cardnum").valid();
        });

        $("#cardnum").rules("add", {
        creditcard2:
                function () {
                    return $("#rblPaymentType input[type=radio]:checked").val();
         }
        });
};

function pageLoad()
{
    paymentpagevalidation();
}

Thanks & Regards,

Abdul Aleem Mohammad
St Louis MO - USA

GeneralRe: Jquery Run Time Error: jquey.validator Pin
jkirkerx3-May-12 19:50
professionaljkirkerx3-May-12 19:50 
GeneralRe: Jquery Run Time Error: jquey.validator Pin
indian1434-May-12 6:26
indian1434-May-12 6:26 
Questionweb Pin
csseyed3-May-12 2:17
csseyed3-May-12 2:17 
AnswerRe: web Pin
Richard MacCutchan3-May-12 6:56
mveRichard MacCutchan3-May-12 6:56 
AnswerRe: web Pin
R. Giskard Reventlov3-May-12 7:48
R. Giskard Reventlov3-May-12 7:48 
QuestionTLS compliant using .net Pin
padmanabhan N2-May-12 21:56
padmanabhan N2-May-12 21:56 
QuestionPlaying music on my end, using APIs of search engines Pin
Neha.prakash882-May-12 21:54
Neha.prakash882-May-12 21:54 
QuestionCredit Card Security Pin
indian1432-May-12 13:28
indian1432-May-12 13:28 
AnswerRe: Credit Card Security Pin
Joshua Omundson2-May-12 14:00
Joshua Omundson2-May-12 14:00 
AnswerRe: Credit Card Security Pin
s_magus2-May-12 15:57
s_magus2-May-12 15:57 
GeneralRe: Credit Card Security Pin
Abel Wike8-Aug-12 1:09
Abel Wike8-Aug-12 1:09 
AnswerRe: Credit Card Security Pin
jkirkerx2-May-12 16:29
professionaljkirkerx2-May-12 16:29 
GeneralRe: Credit Card Security Pin
indian1434-May-12 7:04
indian1434-May-12 7:04 
GeneralRe: Credit Card Security Pin
jkirkerx4-May-12 8:02
professionaljkirkerx4-May-12 8:02 
GeneralRe: Credit Card Security Pin
indian1434-May-12 11:34
indian1434-May-12 11:34 
QuestionUser control loses data on post back Pin
JD862-May-12 6:33
JD862-May-12 6:33 
AnswerRe: User control loses data on post back Pin
R. Giskard Reventlov2-May-12 7:16
R. Giskard Reventlov2-May-12 7:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.