0

我创建了一个页面来通过 jquery UI 日期选择器添加生日。它工作正常。但是在我为字段添加 jquery 验证之后。日期选择器没有出现。但是验证工作正常。谁能给我一个理由和答案?谢谢你。这是我的脚本标签...

    <script src="Scripts/jquery-1.7.2.min.js" type="text/javascript"></script> 
<script  src="Scripts/jquery-ui-1.8.21.custom.min.js" type="text/javascript"></script>
<script type="text/javascript" src="jquery/jquery.min.js"></script>



    </script>
<!-- DIALOG BOX START ------------------------------------------------------------------------------------>
<link href="CSS_D/jquery-ui-1.8.21.custom.css" rel="stylesheet" type="text/css" />
  <script>



$(document).ready(function(){

 $('#search_btn').click(function(){

        if( $('#legacy_code_text').val() == "" && $('#lable_title_text').val() == "" && $('#division_list').val() == -1 &&

        $('#lable_title_text').val() == "" &&       
        $('#file_name_text').val() == "" && 
        $('#bundle_ref_no_text').val() == "" && 
        $('#bundle_shelf_no_text').val() == "" && 
        $('#rack_no_text').val() == "" && 
        $('#shelf_no_text').val() == "" &&      
        $('#date_created_text').val() == "" && 
        $('#date_retained_text').val() == "" && 
        $('#date_to_be_disposed_text').val() == "" &&       
        $('#division_list').val() == -1 &&      
        $('#unit_list').val() == -1 &&
        $('#assignee_code_list').val() == -1 &&
        $('#assignee_list').val() == -1 &&
        $('#subject_list').val() == -1 &&
        $('#serial_no_list').val() == -1 

        ){
        $( "#dialog:ui-dialog" ).dialog( "destroy" );

        $( "#dialog-confirm" ).dialog({
            resizable: false,
            height:140,
            modal: true,
            buttons: {
                "Ok": function() {

                        $( this ).dialog( "close" );



                    //*****************************************************************
                },
                Cancel: function() {
                    $( this ).dialog( "close" );
                }
            }


        });
        }else{ 

        $('#form1').submit();

          }
    });
    });

    </script>

    <!-- DIALOG BOX END ------------------------------------------------------------------------------------>

    <!--Ajax Function To Fill Unit Drop Down------------------------------------------------------------------------>
    <script>
    function fillUnitDropDown(str)
                {
                    var xmlhttp;
                    if (str.length==0)
                    { 
                        document.getElementById("unit_list").innerHTML="";
                        return;
                    }
                    if (window.XMLHttpRequest)
                    {// code for IE7+, Firefox, Chrome, Opera, Safari
                        xmlhttp=new XMLHttpRequest();
                    }
                    else
                    {// code for IE6, IE5
                        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    xmlhttp.onreadystatechange=function()
                    {
                        if (xmlhttp.readyState==4 && xmlhttp.status==200)
                        {
                            document.getElementById("unit_list").innerHTML=xmlhttp.responseText;
                        }
                    }
                    xmlhttp.open("GET","getUnit.php?division="+str,true);
                    xmlhttp.send();
                }


</script>
   <!--Ajax Function To Fill Unit Drop Down END------------------------------------------------------------------------>
<style type="text/css">
body {
    background-color: #B4C8E0;
    background-image: url(images/title2.png),url(images/tile.png);
    background-attachment:fixed;
    background-repeat: repeat ;
    margin:0;
    padding:0;
}
.logdetials .main_bar tr td {
    color: #cdf8ff;
}
a:link {
    color: #cdf8ff;
}

</style>




<!-- SLIDE SHOW START--------------------------------------------------------------------------------------------->
<script type="text/javascript" src="jquery/fadeslideshow.js">

/***********************************************
* Ultimate Fade In Slideshow v2.0- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
***********************************************/

</script>
<script type="text/javascript">


var mygallery=new fadeSlideShow({
    wrapperid: "slide", //ID of blank DIV on page to house Slideshow
    dimensions: [967, 200], //width/height of gallery in pixels. Should reflect dimensions of largest image
    imagearray: [
        ["images/img0.jpg", "", "", "The best way to track your files"],
        ["images/img1.jpg", "", "", "The choice for quality service"],
        ["images/img2.jpg", "", "", "With latest technology"],
        ["images/img3.jpg","","","For a safe and secured place"],
        ["images/img4.jpg", "", "", "Better performance with reliable service"],
        ["images/img5.jpg", "", "", "24 x 7 Service"]

         //<--no trailing comma after very last image element!
    ],
    displaymode: {type:'auto', pause:5000, cycles:0, wraparound:false},
    persist:  false, //remember last viewed slide and recall within same session?
    fadeduration: 1500, //transition duration (milliseconds)
    descreveal: "peekaboo",
    togglerid: ""
})




</script>
<!-- SLIDE SHOW END--------------------------------------------------------------------------------------------->

<!-- Date PICKER START--------------------------------------------------------------------------------------------->
    <link rel="stylesheet" href="JDate/themes/base/jquery.ui.dialog.css">
<script src="JDate/ui/jquery-1.7.2.js"></script>
    <script src="JDate/ui/jquery.ui.core.js"></script>
    <script src="JDate/ui/jquery.ui.widget.js"></script>
    <script src="JDate/ui/jquery.ui.datepicker.js"></script>
    <link rel="stylesheet" href="JDate/demos/demos.css">
    <script>
    $(function() {
        $( "#birthday_text" ).datepicker();

            $( "#birthday_text" ).datepicker( "option", "dateFormat", "yy-mm-dd" );

    });




    </script>
<!-- Date PICKER END --------------------------------------------------------------------------------------------->




<!-- Jquery Validations -------------------------->
<script src="NewFormValidator/js/jquery-1.7.2.min.js" type="text/javascript">
    </script>
    <script src="NewFormValidator/js/languages/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8">
    </script>
    <script src="NewFormValidator/js/jquery.validationEngine.js" type="text/javascript" charset="utf-8">
<link rel="stylesheet" href="NewFormValidator/css/validationEngine.jquery.css" type="text/css"/>



    <script>
        jQuery(document).ready(function(){
            // binds form submission and fields to the validation engine
            jQuery("#form1").validationEngine();
        });

        /**
        *
        * @param {jqObject} the field where the validation applies
        * @param {Array[String]} validation rules for this field
        * @param {int} rule index
        * @param {Map} form options
        * @return an error string if validation failed
        */
        function checkHELLO(field, rules, i, options){
            if (field.val() != "HELLO") {
                // this allows to use i18 for the error msgs
                return options.allrules.validate2fields.alertText;
            }
        }
    </script>
4

1 回答 1

1

一旦我遇到了类似的问题。这是因为 jquery 的不同版本。我认为您也在使用不同版本的 Jquery。删除所有不必要的引用。仅使用一个用于 Datepicker 的 Jquery 参考。

于 2012-08-04T11:36:12.293 回答