- Posts: 10611
- Thank you received: 3691
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
has ls date range question?
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
8 years 10 months ago #120232
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic has ls date range question?
This script will handle text inputs in an array-texts type question:
Sample survey attached.
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify some elements var thisQuestion = $('#question{QID}'); var surveyRoot = location.pathname.split('index.php')[0]; // Define the timepicker function insertPickers() { $('tr.subquestion-list', thisQuestion).each(function(i) { var startDateTextBox = $('input[type="text"]:eq(0)', this); var endDateTextBox = $('input[type="text"]:eq(1)', this); $.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 ) { insertPickers(); }); } else { insertPickers(); } }); </script>
Sample survey attached.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
The following user(s) said Thank You: Ben_V
The topic has been locked.
- Ben_V
- Offline
- Platinum Member
Less
More
- Posts: 1223
- Thank you received: 351
8 years 10 months ago #120234
by Ben_V
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Replied by Ben_V on topic has ls date range question?
Hi Tony,
very useful for users looking for a check-in / check-out "booking" question type
very useful for users looking for a check-in / check-out "booking" question type
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The topic has been locked.
- iscar
- Topic Author
- Offline
- Elite Member
Less
More
- Posts: 169
- Thank you received: 0
8 years 10 months ago #120236
by iscar
Replied by iscar on topic has ls date range question?
thanks for tpartner replay.
the problem is js has no date calculation function then i need to turn the date into timestamp.
tried altfield option,how to use @ to record the date as timestamp and let input display the date?
the problem is js has no date calculation function then i need to turn the date into timestamp.
tried altfield option,how to use @ to record the date as timestamp and let input display the date?
The topic has been locked.