title: JQuery UI DatePicker: how to set value to arbitrary string?
body: <p>I'm looking for a way to make JQuery UI DatePicker to allow setting the date to any arbitrary string, including an invalid date. I need this to give user a chance to change the date he may manually enter, in case this date was in an incorrect format</p>
  
  <p><strong>Steps:</strong></p>
  
  <ul>
  <li>the user manually enters the incorrect date <code>28/13/2012</code> (date format is <code>dd/mm/yy</code>, month 13 is invalid)</li>
  <li>the user validates the form</li>
  <li>struts2 displays the same form again with a message</li>
  </ul>
  
  <p><strong>Expected:</strong> On page redisplay, field is filled with <code>28/13/2012</code> and a message "incorrect date format"</p>
  
  <p><strong>Actual:</strong> The field gets becomes empty</p>
  
  <p>Would'nt it be better for user to get his old incorrect value <code>28/13/2012</code>? How can we achieve this?</p>
  
  <p>Thanks</p>
  
  <hr>
  
  <h1>Addition:</h1>
  
  <p>JSP code:</p>
  
  <pre><code>&lt;s:textfield name="fromDate" cssClass="datePicker" theme="simple"/&gt;
  &lt;s:textfield name="toDate" cssClass="datePicker" theme="simple"/&gt;
  </code></pre>
  
  <p>JS code:</p>
  
  <pre><code>$(document).ready(function(){
      $('input.datePicker').datepicker({
          autoSize: true,
          dateFormat: '&lt;s:text name="date.datePicker.dateFormat"/&gt;',
          showOtherMonths: true,
          selectOtherMonths: true,
          changeMonth: true,
          changeYear: true,
          numberOfMonths: 3,
          dayNamesMin: '&lt;s:text name="date.datePicker.dayNamesMin"/&gt;',
          monthNamesShort: '&lt;s:text name="date.datePicker.monthNamesShort"/&gt;'
      });
  
      // Gestion du la dépendance entre date de début et de fin
      $('input[name="fromDate"]').datepicker( "option", "onClose", function( selectedDate ) {
          $( 'input[name="toDate"]' ).datepicker( "option", "minDate", selectedDate );
      });
      $('input[name="toDate"]').datepicker( "option", "onClose", function( selectedDate ) {
          $( 'input[name="fromDate"]' ).datepicker( "option", "maxDate", selectedDate );
      });
  
  });
  </code></pre>
  
  <p>Java code (Action class):</p>
  
  <pre><code>private String toDate;
  private String fromDate;
  // + getters and setters
  </code></pre>