Create a question with calendar format

Compatibility:IdSurvey 5IdSurvey 6
X

This javascript will turn an open end answer into a calendar (day/month/year). The format is mm-dd-yyyy.

PLEASE NOTE: the general javascript will turn all open end questions into calendar in the page you set the script. If needed, move other open end questions in a different page.

There’s a specific javascript also that allow to transform just a specific text question in the page.

VERSION 6:

In IdSurvey version 6 and following, “Date” question was included as standard type both in the graphic interface (GUI) and in IdCode.

Instructions

Paste the javascript into the Client Script area of the page containing the open end question.

GENERAL JAVASCRIPT:
  <script>
 $(function(){ 
 $(".main-responses :text").datepicker({
 format: "mm-dd-yyyy",
 language: 'en',
 autoclose: true
 });
 });
 </script>
 <style>
 .dropdown-menu{
 background-color: #fff;
 } </style>
SPECIFIC JAVASCRIPT (change code in bold red with code of the question you have to change):
 <script>
 $(function(){
 $(".main-responses[data-questioncode='P1.Q6']").datepicker({
 format: "dd-mm-yyyy",
 language: 'en',
 autoclose: true
 });
 });
 </script>
 <style>
 .dropdown-menu{
 background-color: #fff;
 } </style>

calendar

Leave A Comment?