asmaoui / jquery-datepicker

Automatically exported from code.google.com/p/jquery-datepicker
0 stars 0 forks source link

Year truncated to mm/dd/yy due to page reload on validation error. #10

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Enter date through date time picker.
2. Leave any other mandatory field blank.
3. Submit the form.
4. Validation error will occur and the page will reload.
5. Note the format of the the date entered in step 1 

What is the expected output? What do you see instead?
Expected: The date should be displayed in the same format as was entered
previously i.e. mm/dd/yyyy (for example 11/26/2008)
Actual: The date is displayed in the truncated format i.e. mm/dd/yy (for
example 11/26/08)

Please provide a URL to a page displaying the problem.
Its an enternal application. Sorry about this one.

What version of the datepicker are you using? On what operating system? And
Which Browser?
Struts 2.07
jquery 1.2.6

Please provide any additional information below.
I am using Struts framework for my application and struts validation
framework for validation. Whenever I enter date through date time picker,
it is displayed in correct format i.e mm/dd/yyyy. But when the page reloads
due to validation error, the year is truncated and the date is displayed as
mm/dd/yy. Please help me on this.

Original issue reported on code.google.com by er.sukh...@gmail.com on 16 Dec 2008 at 6:27

GoogleCodeExporter commented 9 years ago
Thanks for the bug report. Which version of the date picker are you using? And 
how do
you initialise the date picker?

Thanks,

Kelvin :)

Original comment by kelvin.l...@gmail.com on 16 Dec 2008 at 9:11

GoogleCodeExporter commented 9 years ago
Thanks for the reply.

I am not sure if this is the issue with date picker or with the conversion
interceptor in struts 2. Still looking into that.

Version is 1.2.6

Below is the script to initialize the picker.

<script type="text/javascript">
            $(document).ready(function(){
               $("#results").hide();
               updateUI();
               stripTables();
               addRemoveHandler();
            });

            function updateUI() {
               $(".date").datepicker({  
                  showOn: "button",
                  showOtherMonths: true,
                  speed:'fast',
                  showAnim: 'fadeIn',
                  buttonImage: "<s:url value="/images/calendar_thumb.gif"/>",  
                  buttonImageOnly: true
               });

               $(".date").width( 120 );
               $(".date").removeClass("date");
               $(".calender_thumb").removeClass("calender_thumb");

               $(".time").width('6em');
               $(".ssn").example("NNN-NN-NNNN");
            }

            function stripTables() {
               $(".tbody tr:even").removeClass("offColor");
               $(".tbody tr:even").addClass("onColor");
               $(".tbody tr:odd").removeClass("onColor");
               $(".tbody tr:odd").addClass("offColor");
            }

            var fadeTime = "slow"
            var count = 1;

            function addRemoveHandler() {
               $("a.remove").click( function() {
                  var nextId = "remove"+count++;
                  $(this).parents("tr").addClass(nextId);

                  $("table tr."+nextId).fadeOut(fadeTime,function (){
                     $("table tr").remove("."+nextId);
                     stripTables(); 
                  });
               });
            }

      </script>

Thanks for youe time.

Original comment by er.sukh...@gmail.com on 16 Dec 2008 at 9:27

GoogleCodeExporter commented 9 years ago
It looks like you are using the jQuery UI datepicker and not my jQuery 
datePicker
(which predates the UI one - otherwise I would have chosen a different name).

If you would like to find out more about my datePicker you can check it out 
here:

http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/

Thanks,

Kelvin :)

Original comment by kelvin.l...@gmail.com on 16 Dec 2008 at 11:32