Welcome to the LimeSurvey Community Forum

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

Expandable Array - Dynamic Grid

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 10 months ago #200956 by Joffm
Replied by Joffm on topic Expandable Array - Dynamic Grid
Hi,
with my not existing knowledge of javascript I tried something with success:

I changed
Code:
if ($(thisRow).attr('data-name') != 'clickedRow') {
            addRow();
            $(thisRow).attr('data-name', 'clickedRow');
            // if you also want to hide the answered row:
            $(thisRow).hide();
          }
to
Code:
if ($(thisRow).attr('data-name') != 'clickedRow') {
            $(thisRow).attr('data-name', 'clickedRow');
            // if you also want to hide the answered row:
            $(thisRow).fadeOut(1000);
            setTimeout(function(){
              addRow();
            }, 1000);
          }
 

Now there is a fade-out and fade-in.
I set to 1000ms. You can change to your needs.

Very probably Tony will have some improvements.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 10 months ago #200958 by tpartner
Replied by tpartner on topic Expandable Array - Dynamic Grid

However, there is one big problem: If radio button of a subquestion is clicked, you can't see that the radio button is checked. It forwards immediately to the next subquestion. Respondents should see their answer for 500ms before next subquestion is shown.

Please read the thread contents and look into the .lss files attached. That behaviour is not a "big problem", it is what oksana wanted. That's why I said "I don't like the idea of hiding the rows as they are answered without any indication of the answer because it gives no opportunity to fix mistaken clicks.".

Simply comment out:
Code:
$(thisRow).hide();

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 10 months ago #200965 by Joffm
Replied by Joffm on topic Expandable Array - Dynamic Grid
Well, nor do I like this behaviour.

Respondents should see their answer for 500ms before next subquestion is shown.

I understood this, that she was concerned about the fact that the subquestion is hidden without visible result of the click.
Therefore she would like to have a small delay.

You see, in your survey the result of the click is not visible, at once the next row is displayed.

Maybe I misunderstood.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
More
3 years 10 months ago #200985 by Andrea01
Replied by Andrea01 on topic Expandable Array - Dynamic Grid
I just added "1000" to "hide" and "show". Now it works fine for me.
That’s all I can do with my poor js-skills.

I am aware that it is no perfect solution, because respondents cannot fix mistaken clicks.
But otherwise they have to scroll down on the smartphone to answer the items and would not see the question any more …

A much better solution would be a fixed question container. Respondents could scroll down an answer the items and would always see the question.


The code I use now:

if ($(thisRow).attr('data-name') != 'clickedRow') {
addRow();
$(thisRow).attr('data-name', 'clickedRow');
// if you also want to hide the answered row:
$(thisRow).hide(1000);
}

// Function to add a row
function addRow() {
$('.relevant-row[data-name="hidden"]:first' ).attr('data-name', 'visible').show(1000);

Best regards,
Andrea
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose