JQuery datepicker issue with IE8

Go To StackoverFlow.com

0

i'm developing a search engine through travel offers, and i0ve got a couple of fields with start date and end date, with datepicker inside. It works good everywhere but in Internet Explorer 8: it show only the first calendar of the 2...IE gives me an alert in these lines, but i cannot see where is the problem:

function spCalendar( id, options, from, to )
{
 jQuery( document ).ready(
  function() {
   jQuery.extend( 
    options, { 
     onClose: function() {
      time =  jQuery( this ).datepicker( 'getDate' );
      jQuery( '#'+this.get( 'id' ).replace( '_selector', '' ) ).val( new Date( time       ).valueOf() ); 
 }     
}
   );
jQuery.extend( options, spCalLang );
jQuery( '#'+id+'_from_selector' ).datepicker( options );
if( from > 0 ) {
 jQuery( '#'+id+'_from_selector' ).datepicker( 'setDate', new Date( from ) );    
}
else {
 jQuery( '#'+id+'_from_selector' ).val( '' );
}      
jQuery( '#'+id+'_to_selector' ).datepicker( options );
if( to > 0 ) {
 jQuery( '#'+id+'_to_selector' ).datepicker( 'setDate', new Date( to ) );    
}
else {
 jQuery( '#'+id+'_to_selector' ).val( '' );
   }   
  } 
 );
}
;

Thanks for help!

here is the page

2012-04-05 15:33
by Francesco Mino Matrioska Fogli
Can you supply a link with the whole script? What error is IE8 giving you - rgvcorley 2012-04-05 15:38
[here is the script] (http://www.mawitalia.it/viaggidiatlantide/components/com_sobipro/var/js/2b243ae1f1120a3d557ef0e4f3189a89.js) IE gives me an unknown function error, but in ie9 and others browser it's all righ - Francesco Mino Matrioska Fogli 2012-04-05 16:00
@FrancescoMinoMatrioskaFogli: Are you still having this problem or have you found a solution - pete 2012-06-21 07:26


0

try

    function() {
        jQuery.extend( 
            options, { 
                onClose: function(dateText, inst) {
                var dtPicker = $("#"+inst.id);
                    time =  dtPicker.datepicker( 'getDate' );
                    jQuery( jQuery(dtPicker).attr( 'id' ).replace( '_selector', '' ) ).val( new Date( time ).valueOf() ); 
                }                   
            }
        );

Also for IE7 Remove the last comma for 'yearSuffix': '',<----

spCalLang = {
'timeOnlyTitle': 'Choose Time',
'timeText': 'Time',
'hourText': 'Hour',
'minuteText': 'Minute',
'secondText': 'Second',
'currentText': 'Oggi',
'closeText': 'Scegli',
'monthNames': ['Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre'],
'monthNamesShort': ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
'dayNames': ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
'dayNamesShort': ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
'dayNamesMin': ['Do', 'Lu', 'Ma', 'Me', 'Gi', 'Ve', 'Sa'],
'weekHeader': '',
'yearSuffix': ''};
2012-04-05 18:37
by KAG
ok!, no the datepicker is showing up, but it seems there some issue with the search function now....each couple of date i choose, the results are always every offer, without the filter by date.. - Francesco Mino Matrioska Fogli 2012-04-07 08:49


0

I don't know if you're still having this problem, but two problems I saw with your OP code have been fixed below:

function spCalendar(id, options, from, to) {
    jQuery(document).ready(function() {
        jQuery.extend(options, {
            "onClose": function() {
                var time = jQuery(this).datepicker('getDate'); //Added var keyword to declare variable
                jQuery('#' + this.get('id').replace('_selector', '')).val(new Date(time).valueOf());
            }
        });
        jQuery.extend(options, spCalLang);
        jQuery('#' + id + '_from_selector').datepicker(options);
        if (from > 0) {
            jQuery('#' + id + '_from_selector').datepicker('setDate', new Date(from));
        } else {
            jQuery('#' + id + '_from_selector').val('');
        }
        jQuery('#' + id + '_to_selector').datepicker(options);
        if (to > 0) {
            jQuery('#' + id + '_to_selector').datepicker('setDate', new Date(to));
        } else {
            jQuery('#' + id + '_to_selector').val('');
        }
    });
}​ //removed unnecessary semi-colon

I no longer have IE8, so I am unable to test the site you linked to. Also, the link to http://www.mawitalia.it/viaggidiatlantide/components/com_sobipro/var/js/2b243ae1f1120a3d557ef0e4f3189a89.js returns a 404 - Not Found.

2012-06-21 07:24
by pete
Ads