Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-18-2013, 06:15 PM   PM User | #1
nani_nisha06
Regular Coder

 
Join Date: Oct 2012
Location: mother land --india
Posts: 159
Thanks: 37
Thanked 2 Times in 2 Posts
nani_nisha06 is an unknown quantity at this point
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 is offline   Reply With Quote
Old 02-18-2013, 06:41 PM   PM User | #2
nani_nisha06
Regular Coder

 
Join Date: Oct 2012
Location: mother land --india
Posts: 159
Thanks: 37
Thanked 2 Times in 2 Posts
nani_nisha06 is an unknown quantity at this point
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 is offline   Reply With Quote
Old 02-19-2013, 05:41 PM   PM User | #3
nani_nisha06
Regular Coder

 
Join Date: Oct 2012
Location: mother land --india
Posts: 159
Thanks: 37
Thanked 2 Times in 2 Posts
nani_nisha06 is an unknown quantity at this point
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>
nani_nisha06 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:16 PM.


Advertisement
Log in to turn off these ads.