CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   JavaScript frameworks (http://www.codingforums.com/forumdisplay.php?f=62)
-   -   Validator in date time picker (http://www.codingforums.com/showthread.php?t=287851)

nani_nisha06 02-18-2013 06:15 PM

Validator in date time picker
 
Hi All,

I am using below Jquery for my datetime picker but now I have serious proble that if end date & time is less then start time my form is accepting the date now I want to restrict it.

Code:

http://trentrichardson.com/examples/timepicker/
The really challenges comes here that i have 20 date time picker columns which runs on the class.

My form condition is if B<A its should echo error & same for if C<B echo error etc etc......till 20 inputs can any one help me with any java code to solve this problem.


Thanks & regards,
nani

nani_nisha06 02-18-2013 06:41 PM

guys I found this script which work more like I expected.

PHP Code:

    $(document).ready(function(){
    $(
"#txtFromDate").datepicker({
        
numberOfMonths2,
        
onSelect: function(selected) {
          $(
"#txtToDate").datepicker("option","minDate"selected)
        }
    });
    $(
"#txtToDate").datepicker({
       
numberOfMonths2,
        
onSelect: function(selected) {
        $(
"#txtFromDate").datepicker("option","maxDate"selected)
        }
    }); 
}); 

I found it on below link

Code:

http://jquerybyexample.blogspot.com/2012/01/end-date-should-not-be-greater-than.html
But I dont know how to match up this thing to mine.

any help is most appreciated...

nani_nisha06 02-19-2013 05:41 PM

Guys,

below code worked for me but, with multiple challenges.

a) If startdate input is echoing from DB, enddate should not display days before the startdate but below code dose not do it. any support is appreciated.

Code:

        <script>
        $(document).ready(function() {
$        (".startdate").datetimepicker({
                        showSecond: true,
                        dateFormat:'yy-mm-dd',
                        timeFormat: 'HH:mm:ss',
                        numberOfMonths: 2,
                        stepHour: 1,
                        stepMinute: 1,
                        stepSecond: 1,
        onSelect: function(selected) {
          $(".enddate").datetimepicker("option","minDate", selected)
        }
    });
    $(".enddate").datetimepicker({
                        showSecond: true,
                        dateFormat:'yy-mm-dd',
                        timeFormat: 'HH:mm:ss',
                        numberOfMonths: 2,
                        stepHour: 1,
                        stepMinute: 1,
                        stepSecond: 1,
        onSelect: function(selected) {
        $(".startdate").datetimepicker("option","maxDate", selected)
      }
    });
});
</script>



All times are GMT +1. The time now is 12:10 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.