Welcome to the LimeSurvey Community Forum

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

Hejri / Islamic Date

  • elfatihnadir
  • elfatihnadir's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 9 months ago #229140 by elfatihnadir
Hejri / Islamic Date was created by elfatihnadir
Please help us help you and fill in where relevant:
Your LimeSurvey version: 3.25.20
Own server or LimeSurvey hosting: Own Server
Survey theme/template:
==================
first of all, I appreciate all your hard work and making things easy for us.
I have a date question, can I add the Islamic calendar ? and how if I can? 

Please Log in to join the conversation.

  • elfatihnadir
  • elfatihnadir's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 9 months ago #229145 by elfatihnadir
Replied by elfatihnadir on topic Hejri / Islamic Date
anyone please ?

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 9 months ago #229153 by holch
Replied by holch on topic Hejri / Islamic Date
I highly doubt that this is possible. Limesurvey is based on PHP and uses their date system. And PHP draws time and date from the server's system time.

So you probably would have to search on how you can convert the standard php date to the islamic calendar. I have no clue how this calendar is different.

If you search for "PHP islamic date/calendar" you should get some hints:

ar-php.org/github/examples/date.php
stackoverflow.com/questions/13578749/hij...ng-php-or-javascript

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: elfatihnadir

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 9 months ago #229154 by holch
Replied by holch on topic Hejri / Islamic Date
And by the way: When you asked your question it was Sunday and for many of the respondents here in the forum that means that it is the weekend and a day off. There is very little action in the forum on Saturdays and Sundays...

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: elfatihnadir

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 9 months ago #229157 by tpartner
Replied by tpartner on topic Hejri / Islamic Date
I think you will need to insert your own datepicker instead of using the core question type.

Maybe in a custom question theme using a platform like this - github.com/balbarak/bootstrap-hijri-datepicker

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: elfatihnadir

Please Log in to join the conversation.

  • elfatihnadir
  • elfatihnadir's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 9 months ago #229168 by elfatihnadir
Replied by elfatihnadir on topic Hejri / Islamic Date
now i understand, thank you

Please Log in to join the conversation.

  • elfatihnadir
  • elfatihnadir's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 9 months ago - 1 year 9 months ago #229184 by elfatihnadir
Replied by elfatihnadir on topic Hejri / Islamic Date
I had another idea to use two types of calendars, which is using an array text question and adding a script to the question to make the array text dropdown list and then fill in the cells, but I have one problem with the script if I add an element to Subquestion 1. then all the Subquestions that in the same column will be filled with the same elements

here is the question sample
[MOD: Screenshot deleted as it was causing "code salad"]

and  here is the script and the source that i copied the script from
<p>Q1e...</p>
<script type="text/javascript" charset="utf-8">
    $(document).on('ready pjax:scriptcomplete',function(){
        var thisQuestion = $('#question{QID}');
 
        // Insert selects
        $('.answer-item.answer_cell_X001', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
  <option value="">select...</option>\
  <option value="1">000</option>\
  <option value="2">000</option>\
  <option value="3">000</option>\
  <option value="4">000</option>\
  <option value="5">0e0</option>\
  <option value="6">0e0</option>\
  <option value="7">000</option>\
  <option value="8">0w</option>\
  <option value="9">000</option>\
</select>');
$('.answer-item.answer_cell_X002', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
  <option value="">select...</option>\
  <option value="1">1</option>\
  <option value="3">3</option>\
  <option value="5">5</option>\
</select>'); 
$('.answer-item.answer_cell_X003', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
  <option value="">select...</option>\
  <option value="1">1</option>\
  <option value="5">5</option>\
  <option value="7">7</option>\
  <option value="9">9</option>\
</select>'); 
$('.answer-item.answer_cell_X004', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
  <option value="">select...</option>\
  <option value="1">1</option>\
  <option value="5">5</option>\
  <option value="6">6</option>\
  <option value="7">7</option>\
  <option value="8">8</option>\
</select>'); 

        // Listeners
        $('.inserted-select', thisQuestion).on('change', function(i) {
            if($(this).val() != '') {
                $(this).closest('.answer-item').find('input:text').val($.trim($('option:selected', this).text())).trigger('change');
            }
            else {
                $(this).closest('.answer-item').find('input:text').val('').trigger('change');
            }
        });
 
        // Returning to page
        $('.with-select input:text', thisQuestion).each(function(i) {
            var thisCell = $(this).closest('.answer-item');
            var inputText = $.trim($(this).val());
            var selectval = $('select.inserted-select option',          thisCell).filter(function () { return $(this).html() == inputText; }).val();
            $('select.inserted-select', thisCell).val(selectval);
        });
 
        // Clean-up styles
        $('select.inserted-select', thisQuestion).css({
            'max-width': '100%'
        });
        $('.with-select input:text', thisQuestion).css({
            'position': 'absolute',
            'left': '-9999em'
        });
    });
</script>

source:
forums.limesurvey.org/forum/can-i-do-thi...own-in-a-array-texts

can i make each cell independent in case of adding new elements ?
Last edit: 1 year 9 months ago by holch. Reason: Screenshot deleted as it was causing "code salad"

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 9 months ago #229185 by holch
Replied by holch on topic Hejri / Islamic Date
Please do not copy and paste images into the editor, it will just appear as gargled up code, see above.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 9 months ago #229188 by tpartner
Replied by tpartner on topic Hejri / Islamic Date
I find it amazing that people don't look at the post after submitting.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • elfatihnadir
  • elfatihnadir's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 9 months ago #229190 by elfatihnadir
Replied by elfatihnadir on topic Hejri / Islamic Date
I didn't know that I apologize, sir

I attached the question file as well as the image for the question.
as I mentioned above, I have one problem with the script if I add an element to Subquestion 1. then all the Subquestions that are in the same column will be filled with the same elements, can this be solved by the script above?

Thanks in advance.

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 9 months ago #229193 by holch
Replied by holch on topic Hejri / Islamic Date
I will edit the post and delete the image, to make this thread easier to follow.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 9 months ago #229197 by tpartner
Replied by tpartner on topic Hejri / Islamic Date
Question exports don't help us as we don't want to waste time creating surveys. Please always provide survey exports (.lss files) containing only the relevant questions.

You can target specific y-scale sub-questions something like this example which will only insert the drop-downs in the row with sub-question code "Y001".

Code:
<script type="text/javascript" data-author="Tony Partner">  
 
  $(document).on('ready pjax:scriptcomplete',function(){
    var thisQuestion = $('#question{QID}');
 
    // Insert selects
    // Y001, X001
    $('tr[id$="Y001"] .answer-item.answer_cell_X001', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
        <option value="">select...</option>\
        <option value="1">000</option>\
        <option value="2">000</option>\
        <option value="3">000</option>\
        <option value="4">000</option>\
        <option value="5">0e0</option>\
        <option value="6">0e0</option>\
        <option value="7">000</option>\
        <option value="8">0w</option>\
        <option value="9">000</option>\
      </select>');
    // Y001, X002
    $('tr[id$="Y001"] .answer-item.answer_cell_X002', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
        <option value="">select...</option>\
        <option value="1">1</option>\
        <option value="3">3</option>\
        <option value="5">5</option>\
      </select>'); 
    // Y001, X003
    $('tr[id$="Y001"] .answer-item.answer_cell_X003', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
      <option value="">select...</option>\
      <option value="1">1</option>\
      <option value="5">5</option>\
      <option value="7">7</option>\
      <option value="9">9</option>\
    </select>');
 
    // Listeners
    $('.inserted-select', thisQuestion).on('change', function(i) {
      if($(this).val() != '') {
        $(this).closest('.answer-item').find('input:text').val($.trim($('option:selected', this).text())).trigger('change');
      }
      else {
        $(this).closest('.answer-item').find('input:text').val('').trigger('change');
      }
    });
 
    // Returning to page
    $('.with-select input:text', thisQuestion).each(function(i) {
      var thisCell = $(this).closest('.answer-item');
      var inputText = $.trim($(this).val());
      var selectval = $('select.inserted-select option', thisCell).filter(function () { return $(this).html() == inputText; }).val();
      $('select.inserted-select', thisCell).val(selectval);
    });
 
    // Clean-up styles
    $('select.inserted-select', thisQuestion).css({
      'max-width': '100%'
    });
    $('.with-select input:text', thisQuestion).css({
      'position': 'absolute',
      'left': '-9999em'
    });
  });
</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: elfatihnadir

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose