0

When i remove date format from my code it works fine.But when i add date format ,then the checks of from date and to date dont work.i.e my validation logic fails for to date and from date.

A

<script type="text/javascript">

    $(function () {

        $.datepicker.setDefaults({  
            **dateFormat:'dd/mm/yy',**             
            showOn: "both",
            buttonImageOnly: true,
            buttonImage: 'images/calender.jpg',
            buttonText: "Calendar",
            defaultDate: "+1w",
            changeMonth: true,
            numberOfMonths: 1,
        });

        var dates = $('#from, #top').datepicker({  

                onSelect: function (selectedDate) {               
                var option = this.id == "from" ? "minDate" : "maxDate";                    
                dates.not(this).datepicker("option", option, new Date(selectedDate));
            }
        });

    });

</script>


<label for="from">
    From</label>
<asp:TextBox ID="from" runat="server"></asp:TextBox>
<label for="to">
    To</label>
<asp:TextBox ID="to" runat="server"></asp:TextBox>
2
  • I see no validation happening here... May 30, 2013 at 10:25
  • var dates = $('#from, #top').datepicker({ onSelect: function (selectedDate) { var option = this.id == "from" ? "minDate" : "maxDate" dates.not(this).datepicker("option", option, new Date(selectedDate));.................Its more like a business logic to date cant be less than from date and vica versa.. May 31, 2013 at 2:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.