Index: trunk/extensions/SemanticFormsInputs/SFI_Inputs.php |
— | — | @@ -840,12 +840,7 @@ |
841 | 841 | // assemble JS code to attach datepicker to input field |
842 | 842 | $jstext = <<<JAVASCRIPT |
843 | 843 | jQuery("#" + inputId + "_show").datepicker( $jsattribsString ); |
844 | | - jQuery("#" + inputId + "_show").datepicker( "setDate", jQuery.datepicker.parseDate("yy/mm/dd", "$cur_value", null) ); |
845 | 844 | jQuery("#" + inputId + "_show").datepicker( "option", "altField", "#" + inputId); |
846 | | - jQuery("#" + inputId + "_show").change(function() { |
847 | | - jQuery("#" + inputId ).attr("value", jQuery.datepicker.parseDate(jQuery(this).datepicker( "option", "dateFormat"), jQuery(this).attr("value"), null)); |
848 | | - }); |
849 | | - |
850 | 845 | JAVASCRIPT; |
851 | 846 | |
852 | 847 | // append setting of first date |
— | — | @@ -952,10 +947,27 @@ |
953 | 948 | JAVASCRIPT; |
954 | 949 | } |
955 | 950 | |
956 | | - // wrap the JS code fragment in a function which can be called by SF for deferred init |
| 951 | + // set value of datepicker, attach event listener for keyboard input |
| 952 | + // and wrap the JS code fragment in a function which can be called |
| 953 | + // by SF for deferred init |
957 | 954 | $jstext = <<<JAVASCRIPT |
958 | 955 | function initInput$sfgFieldNum(inputId) { |
959 | 956 | $jstext |
| 957 | + try { |
| 958 | + jQuery("#" + inputId + "_show").datepicker( "setDate", jQuery.datepicker.parseDate("yy/mm/dd", "$cur_value", null) ); |
| 959 | + } catch (e) { |
| 960 | + jQuery("#" + inputId + "_show").attr("value", "$cur_value"); |
| 961 | + jQuery("#" + inputId).attr("value", "$cur_value"); |
| 962 | + } |
| 963 | + |
| 964 | + jQuery("#" + inputId + "_show").change(function() { |
| 965 | + try { |
| 966 | + jQuery("#" + inputId ).attr("value", jQuery.datepicker.parseDate(jQuery(this).datepicker( "option", "dateFormat"), jQuery(this).attr("value"), null)); |
| 967 | + } catch (e) { |
| 968 | + jQuery("#" + inputId).attr("value", jQuery(this).attr("value")); |
| 969 | + } |
| 970 | + }); |
| 971 | + |
960 | 972 | } |
961 | 973 | |
962 | 974 | addOnloadHook(function(){initInput$sfgFieldNum("input_$sfgFieldNum");}); |