Hi,
   In the below Code takes too much of time for execute I don't know
did I made any mistake.

function chkLicense() {
    var firstLicDD = '', secLicDD = '', ddLicValue = '', ddStateValue
= '';
    var firstStateDD = '', SecStateDD = '';
    var IsTwoDentLICandSTATEsame = false, firstDDIndex = null,
isLicenseNotSel = false;
    var isStateNotSel = false, isTwoLICsameExceptDental = false;
    var isDntlMedHaveAllState = false; isLicEmpty = false;
    var $myTable = $('#Licenses tr');
    $myTable.each(function(index) {
        var LicNo = '', ddindex = '';
        firstDDIndex = index;
        if (index > 0) {
            firstLicDD = $(this).find('td :DropDownList').eq(2).val();
            /*For PA DropDown*/
            //firstStateDD = $(this).find('td :DropDownList').eq
(11).val();
            /*For Html DropDown*/
            firstStateDD = $(this).find('td :DropDownList').eq(10).val
();
            //if ((firstLicDD == 1) || (firstLicDD == 5)) {
            if (({ 1: 1, 5: 1 })[firstLicDD]) {
                if (firstStateDD == 0) {
                    isDntlMedHaveAllState = true;
                }
            }
            //if (firstLicDD == '' || firstLicDD == null) {
            if (firstLicDD == '' || firstLicDD == null) {
                isLicenseNotSel = true;
            }
            if (firstStateDD == '' || firstStateDD == null) {
                isStateNotSel = true;
            }
            LicNo = $(this).find("td").eq(2)[0].childNodes[0].value;
            if (LicNo == '' || LicNo == null) {
                isLicEmpty = true;
            }

            if (firstLicDD != "") {
                $myTable.each(function(index) {
                    if (index > 0) {
                        secLicDD = '', SecStateDD = '';
                        secLicDD = $(this).find('td :DropDownList').eq
(2).val();
                        /*For PA DD*/
                        //SecStateDD = $(this).find
('td :DropDownList').eq(11).val();
                        /*For Html.DD*/
                        SecStateDD = $(this).find
('td :DropDownList').eq(10).val();
                        if (SecStateDD != '') {
                            for (var i = 0; i <= parseInt(SecStateDD)
+ 1; i++) {
                                /*For PA DD*/
                                //if ($(this).find('td :DropDownList')
[11][i].value == SecStateDD) {
                                /*For Html.DD*/
                                if ($(this).find('td :DropDownList')
[10][i].value == SecStateDD) {
                                    ddindex = i;
                                }
                            }
                        }
                        if (secLicDD != "") {
                            if (firstDDIndex != index) {
                                if (firstLicDD == secLicDD) {
                                    if ((firstLicDD == 1) && (secLicDD
== 1)) {
                                        if ((secLicDD == 1) &&
(SecStateDD > 0)) {
                                            /*For PA DD*/
                                            //var ddSelectedText = $
(this).find('td :DropDownList')[11][ddindex].innerHTML;
                                            /*For Html DD*/
                                            var ddSelectedText = $
(this).find('td :DropDownList')[10][ddindex].innerHTML;
                                            var Prvid = $
('#PrimaryKey')[0].value;
                                            var stateCode =
ddSelectedText;
                                            var LicenseTypeID =
firstLicDD;
                                            //fnIsAllStateForDenMed
(Prvid, stateCode, LicenseTypeID);
                                        }
                                        if (SecStateDD != "") {
                                            if (firstStateDD ==
SecStateDD) {
 
IsTwoDentLICandSTATEsame = true;
                                            }
                                        }
                                    }
                                    else {
                                        isTwoLICsameExceptDental =
true;
                                    }
                                }
                            }
                        }
                    }
                });

            }
        }
    });
    if (isStateNotSel || isLicenseNotSel || IsTwoDentLICandSTATEsame
                    || isTwoLICsameExceptDental || isLicEmpty ||
isDntlMedHaveAllState) {
        var message = ' ';
        if (isLicenseNotSel) {
            message += "  Select Licence \n" + "<br/>";
        }
        if (isStateNotSel) {
            message += "  Select State" + "<br/>";
        }
        if (isDntlMedHaveAllState) {
            message += "Dental and Medi-Caid License Type should not
have All State" + "<br/>";
        }
        if (isTwoLICsameExceptDental) {
            message += "Two License Types should not be Same Except
Dental" + "<br/>";
        }
        if (IsTwoDentLICandSTATEsame) {
            message += "Dental License Types should have unique state"
+ "<br/>";
        }
        if (isLicEmpty) {
            message += "Enter License Number" + "<br/>";
        }
        $('#LicenseErrormsg').html(message);
        return false;
    }
    else {
        $('#LicenseErrormsg').html("");
        return true;
    }
}


Thank You in Advance.
Nizam

--

You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=.


Reply via email to