Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Oct 2012
    Location
    mother land --india
    Posts
    165
    Thanks
    38
    Thanked 2 Times in 2 Posts

    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

  • #2
    Regular Coder
    Join Date
    Oct 2012
    Location
    mother land --india
    Posts
    165
    Thanks
    38
    Thanked 2 Times in 2 Posts
    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...

  • #3
    Regular Coder
    Join Date
    Oct 2012
    Location
    mother land --india
    Posts
    165
    Thanks
    38
    Thanked 2 Times in 2 Posts
    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>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •