Index: trunk/extensions/SemanticFormsInputs/SFI_Inputs.php |
— | — | @@ -322,8 +322,8 @@ |
323 | 323 | . $wgLang->firstChar( wfMsg( 'fri' ) ) . "','" |
324 | 324 | . $wgLang->firstChar( wfMsg( 'sat' ) ) . "'],\n" |
325 | 325 | . " weekHeader: '',\n" |
326 | | - . " dateFormat: '" . wfMsg( 'semanticformsinputs-dateformat' ) . "',\n" |
327 | | - . " firstDay: '" . wfMsg( 'semanticformsinputs-firstday' ) . "',\n" |
| 326 | + . " dateFormat: '" . wfMsg( 'semanticformsinputs-dateformatshort' ) . "',\n" |
| 327 | + . " firstDay: '" . wfMsg( 'semanticformsinputs-firstdayofweek' ) . "',\n" |
328 | 328 | . " isRTL: " . ( $wgLang->isRTL() ? "true":"false" ) . ",\n" |
329 | 329 | . " showMonthAfterYear: false,\n" |
330 | 330 | . " yearSuffix: ''};\n" |
— | — | @@ -947,27 +947,20 @@ |
948 | 948 | JAVASCRIPT; |
949 | 949 | } |
950 | 950 | |
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 |
| 951 | + // set value of datepicker and wrap the JS code fragment in a |
| 952 | + // function which can be called by SF for deferred init |
954 | 953 | $jstext = <<<JAVASCRIPT |
955 | 954 | function initInput$sfgFieldNum(inputId) { |
956 | 955 | $jstext |
957 | 956 | try { |
| 957 | + re = /\d{4}\/\d{2}\/\d{2}/ |
| 958 | + if ( ! re.test("$cur_value") ) {throw "Wrong date format!";} |
958 | 959 | jQuery("#" + inputId + "_show").datepicker( "setDate", jQuery.datepicker.parseDate("yy/mm/dd", "$cur_value", null) ); |
959 | 960 | } catch (e) { |
960 | 961 | jQuery("#" + inputId + "_show").attr("value", "$cur_value"); |
961 | 962 | jQuery("#" + inputId).attr("value", "$cur_value"); |
962 | 963 | } |
963 | 964 | |
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 | | - |
972 | 965 | } |
973 | 966 | |
974 | 967 | addOnloadHook(function(){initInput$sfgFieldNum("input_$sfgFieldNum");}); |