Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

has ls date range question?

  • iscar
  • iscar's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
8 years 10 months ago - 8 years 10 months ago #120065 by iscar
has ls date range question? was created by iscar
it's a basic type question in other system,you can set the tick as year or month or day,even sencond. like below





has ls date range question?
Attachments:
Last edit: 8 years 10 months ago by iscar.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 10 months ago #120068 by DenisChenu
Replied by DenisChenu on topic has ls date range question?
Hi,

No actually ls core don't have range question type. You must use own javascript.

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 10 months ago #120080 by tpartner
Replied by tpartner on topic has ls date range question?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • iscar
  • iscar's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
8 years 10 months ago #120082 by iscar
Replied by iscar on topic has ls date range question?
the difficulty is have no idea about the ls data storage predefined variables.
suppose i can use js, how to combine the js and ls core.
and, this is date range, and can set the date level.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 10 months ago #120083 by tpartner
Replied by tpartner on topic has ls date range question?
For date ranges, how about this - longbill.github.io/jquery-date-range-picker/

You can apply it to a short-text question something like this (after including necessary files).

Code:
<script type="text/javascript" charset="utf-8">  
  $(document).ready(function() {
    $('#question{QID} input[type="text"]').dateRangePicker({
      startOfWeek: 'monday',
      separator : ' ~ ',
      format: 'DD.MM.YYYY HH:mm',
      autoClose: false,
      time: {
        enabled: true
      }
    });
  });
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: iscar
The topic has been locked.
  • iscar
  • iscar's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
8 years 10 months ago #120084 by iscar
Replied by iscar on topic has ls date range question?
i think a date range should has 2 values, then lots of calculation can be used, i review other systems, for example, calculate 2 date range overlapp.
your first car, your sencond car, then we know the overlap of these 2 car.
actually, date range question is the time position, i think it's the essentail type question.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 10 months ago #120087 by DenisChenu
Replied by DenisChenu on topic has ls date range question?
Actually : for date range, think you can use 2 date question type with min/max set .

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • iscar
  • iscar's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
8 years 10 months ago #120088 by iscar
Replied by iscar on topic has ls date range question?
i tried to use this method but partcipant feel not good,answer 2 questions but for 1 thing. it's terrible if ls has no subquestion.
i am learning Use two inputs from the reference site,i think date range should be a basic type question.
The topic has been locked.
  • iscar
  • iscar's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
8 years 10 months ago #120112 by iscar
Replied by iscar on topic has ls date range question?
i tested it, good function like predefined range.
i think the best solution is use 2 date in one ls question, and use js combine 2 date with ~,then we can calculate.
The topic has been locked.
  • iscar
  • iscar's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
8 years 10 months ago #120117 by iscar
Replied by iscar on topic has ls date range question?
hi tpartner,
did you test other js?
i tried a better one, trentrichardson.com/examples/timepicker/
but this one is not work with ls, i guess some js conflict?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 10 months ago - 8 years 10 months ago #120131 by tpartner
Replied by tpartner on topic has ls date range question?
Well LimeSurvey already comes with that plugin - you just need to insert it.

Add something like this to the source of a multiple-short-text with 2 sub-questions:

Code:
<script type="text/javascript" charset="utf-8">  
 
  $(document).ready(function() {  
 
    // Identify some elements
    var thisQuestion = $('#question{QID}');
    var startDateTextBox = $('input.text:eq(0)', thisQuestion);
    var endDateTextBox = $('input.text:eq(1)', thisQuestion);
 
    var surveyRoot = location.pathname.split('index.php')[0];
 
    // Define the timepicker    
    function insertPicker() {
      $.timepicker.datetimeRange(
        startDateTextBox,
        endDateTextBox,
        {
          minInterval: (1000*60*60), // 1hr
          dateFormat: 'dd M yy', 
          timeFormat: 'HH:mm',
          start: { }, // start picker options
          end: { } // end picker options          
        }
      );
    }
 
    // Insert the timepickers
    if (!$.isFunction($.fn.timepicker)) {      
      $('head link[rel="stylesheet"]').last().after('<link rel="stylesheet" href="'+surveyRoot+'third_party/jquery-ui-timepicker-addon/jquery-ui-timepicker-addon.css" type="text/css" media="screen">');
      $.getScript( surveyRoot+'third_party/jquery-ui-timepicker-addon/jquery-ui-timepicker-addon.js', function( data, textStatus, jqxhr ) {
        insertPicker();
      });
    }
    else {  
      insertPicker();
    }
  });
</script>

File Attachment:

File Name: limesurvey...8984.lss
File Size:15 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 8 years 10 months ago by tpartner.
The topic has been locked.
  • iscar
  • iscar's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
8 years 10 months ago #120134 by iscar
Replied by iscar on topic has ls date range question?
i tested it, really good and no conflict.just not support other language, doesnot matter.
if i use the start-end in array type text question, how to revise the script accordingly?

Attachments:
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose