I am adding DatePicker to a class of fields. The calendar control displays nicely and a value shows in my textbox when I select a date.
When I click off the field, the textbox onblur does not see the value. Any ideas on what I am missing?
Thanks for the help.
<script type="text/javascript">
$(function(){
$( ".datepicker" ).datepicker();
});
</script>
<input type="text" id="A4" name="A4" size="10" class="datepicker" value="" style="text- align: right; background-color: #FFFFFF;" title="A4" tabindex="34"
onclick="return clickValue(this,'A4');"
ondblclick="dblClickValue(this,'A4')"
onfocus="focusValue(this,'A4')"
onblur="return blurValue(this,'A4')"
onkeypress="return keyPressHandle(this,event,'A4')"
onkeyup="return keyUpHandle(this,'A4')"
onkeydown="return keyDownHandle(this,event,'A4')">
function blurValue(obj,field) {
alert(obj.value + field);
if(gAutoFormulate && gField==field) return true;
//restoreCellColor( obj );
saveAndSetValue(obj,field);
return false;
}
It turns out the text box blur event will occur before datepicker will put in its value. I invoked the blur from datepicker's close event.
$(function() {
$('.datepicker').datepicker({
onClose: function() {
$(this).trigger('blur');
}
});
}); //ready
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments