Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Change format Datepicker

Hi,

I have implemented a jquery datepicker in a free format question. I want to display a date format different that the data saved.

date display : dd/mm/yyyy
and date saved : yyyy-mm-dd.

See my code :

 
 

html 
<input type="text" class=PS4_date>
 <input type="hidden" name=PS4_date >

JS 
<script type="text/javascript">

$(function() {
  $('.PS4_date').each(function(){
      var alt=$(this).next();
      $(this).datepicker({
           minDate: "01/01/1900",
          maxDate: "0",
                  dateFormat: "dd/mm/yy",
                 altFormat: "yy-mm-dd",
                 altField:alt
      })
  })
 })
</script>


The result is good. The date display is well : dd/mm/yy and the date saved is well in the format yyyy-mm-dd when I click on next page, but when I came back I can not recover the date saved .

Do you have a solution ? Or it's possible and easier with your calendar sawtooth ?
asked 4 days ago by Virginie

1 Answer

0 votes
You will need to have two free format variables.  Then the HTML needs to look like this:

<input name="[% QuestionName() %]_date1" id="[% QuestionName() %]_date1" type="text" value=""/>
<input name="[% QuestionName() %]_date2" id="[% QuestionName() %]_date2" type="hidden" value=""/>


where "date1" and "date2" are the names of the variables.
answered 4 days ago by Zachary Platinum Sawtooth Software, Inc. (129,150 points)
...