Datepicker 질문드립니다.

Datepicker 질문드립니다.

QA

Datepicker 질문드립니다.

본문

자료 조회할 때 사용할 두개의 Datepicker를만들었습니다

 

줄여서 1번 2번이라고 하겠습니다.

 

지금 minDate, maxDate가 설정이 되어진 상태이구요

 

2번이 1번의 데이터값보다 작게 설정이 되거나 반대로 1번이 2번보다 크게 값이 설정 되어도

 

조회버튼을 눌렀을때 데이터만 호출이 안될뿐이지 명령을 실행시켜 버리더군요

 

이때 제약을 두고자 합니다.

 

1번이 2번보다 큰 Date값을 입력하면 2번의 Date값을 1번과 동일하게 설정하였으면 합니다

 

반대도 마찬가지이구요

 

이 때 어떻게 하면 이 이벤트를 적용시킬 수 있을까요?

 

$( "#fromDatepicker" ).datepicker({

//showOn: "both", 

changeMonth: true, 

changeYear: true,

nextText: '다음 달',

prevText: '이전 달',

changeMonth: true, 

dayNames: ['월요일', '화요일', '수요일', '목요일', '금요일', '토요일', '일요일'],

dayNamesMin: ['월', '화', '수', '목', '금', '토', '일'], 

monthNamesShort: ['1','2','3','4','5','6','7','8','9','10','11','12'],

monthNames: ['1월','2월','3월','4월','5월','6월','7월','8월','9월','10월','11월','12월'],

dateFormat: "yy-mm-dd",

minDate : "2016-09-01",

maxDate : "2016-09-06"

});

 

$( "#toDatepicker" ).datepicker({

//showOn: "both", 

changeMonth: true, 

changeYear: true,

nextText: '다음 달',

prevText: '이전 달',

changeMonth: true, 

dayNames: ['월요일', '화요일', '수요일', '목요일', '금요일', '토요일', '일요일'],

dayNamesMin: ['월', '화', '수', '목', '금', '토', '일'], 

monthNamesShort: ['1','2','3','4','5','6','7','8','9','10','11','12'],

monthNames: ['1월','2월','3월','4월','5월','6월','7월','8월','9월','10월','11월','12월'],

dateFormat: "yy-mm-dd",

minDate : "2016-09-01",

maxDate : "2016-09-06"

});

이 질문에 댓글 쓰기 :

답변 1

 
$( "#fromDatepicker" ).datepicker({
	//showOn: "both", 
	changeMonth: true, 
	changeYear: true,
	nextText: '다음 달',
	prevText: '이전 달',
	changeMonth: true, 
	dayNames: ['월요일', '화요일', '수요일', '목요일', '금요일', '토요일', '일요일'],
	dayNamesMin: ['월', '화', '수', '목', '금', '토', '일'], 
	monthNamesShort: ['1','2','3','4','5','6','7','8','9','10','11','12'],
	monthNames: ['1월','2월','3월','4월','5월','6월','7월','8월','9월','10월','11월','12월'],
	dateFormat: "yy-mm-dd",
	minDate : "2016-09-01",
	maxDate : "2016-09-06",
onSelect : function(dateText){
$( "#toDatepicker" ).val(dateText)
} 
});
 
 
$( "#toDatepicker" ).datepicker({
	//showOn: "both", 
	changeMonth: true, 
	changeYear: true,
	nextText: '다음 달',
	prevText: '이전 달',
	changeMonth: true, 
	dayNames: ['월요일', '화요일', '수요일', '목요일', '금요일', '토요일', '일요일'],
	dayNamesMin: ['월', '화', '수', '목', '금', '토', '일'], 
	monthNamesShort: ['1','2','3','4','5','6','7','8','9','10','11','12'],
	monthNames: ['1월','2월','3월','4월','5월','6월','7월','8월','9월','10월','11월','12월'],
	dateFormat: "yy-mm-dd",
	minDate : "2016-09-01",
	maxDate : "2016-09-06",
onSelect : function(dateText){
$( "#fromDatepicker" ).val(dateText)
} 
});
 

 

위와 onSelect 이용하시면 됩니다. 

답변을 작성하시기 전에 로그인 해주세요.
전체 46
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT