Welcome to the LimeSurvey Community Forum

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

How to match a response from a specific cell from a dropdown list

  • CultureCommunication
  • CultureCommunication's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 5 months ago #231060 by CultureCommunication
Please help us help you and fill where relevant:
Your LimeSurvey version: Lime survey cloud 5.3.25
Own server or LimeSurvey hosting:
Survey theme/template: Bootswatch
==================
Hello everyone,
I am new to Lime and to programming. Thankfully, I had help from this forum to develop a table with a drop-down list in three languages. 
I would like to know if it is possible to replace or capture a response in a specific cell (i.e., X001code, X002code, etc) in either language with a different value instead of the text? For example, if a respondent selects response (X001code) (Missing, no disponible or non disponible), I want to replace the text ineither language with a single code (i.e., "M", "X",, "Z", etc) regardless of language. 
Thank you. 

File Attachment:

File Name: surveys_12345.zip
File Size:7 KB

File Attachment:

File Name: surveys_12345.zip
File Size:7 KB

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 5 months ago #231062 by Joffm
Hi,
you used the wrong script.
I don't know where you found it.
This script stores the text.

To store the value change the "listeners" and "Returning to page" part to
Code:
    // Listeners
    $('.inserted-select', thisQuestion).on('change', function(i) {
      if($(this).val() != '') {
        $(this).closest('.answer-item').find('input:text').val($('option:selected', this).val()).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());
      $('select.inserted-select', thisCell).val(inputText);
    });

 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:

Please Log in to join the conversation.

  • CultureCommunication
  • CultureCommunication's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 5 months ago #231087 by CultureCommunication
Thanks so much for your assistance Joffm! This is great and it works perfectly.

Bea

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose