Welcome to the LimeSurvey Community Forum

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

Custom Array

  • rajkumar_dms
  • rajkumar_dms's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
1 week 20 hours ago - 1 week 19 hours ago #267884 by rajkumar_dms
Custom Array was created by rajkumar_dms
Please help us help you and fill where relevant:
LimeSurvey version: [6.6]
Own server or LimeSurvey Cloud:Cloud
Survey theme/template:
Fruity ( fruity )
==================
Hello Team,
I had made custom array(texts) with some with java script so i want add some new logic with this so can't do that 

If you look at attached the lss file Q1 have some brand and Q2 are brand with SKU and selected brand and their SKU are visible then i ask is stocked up or not Then the inline Radio Bottom "Yes/No" will show if select Yes then next answer will ask otherwise not and can't be blank and answer will be only numeric ,if selected "No" the next filed will be not ask or read only and one more things if i back then selected answer should not be over write

File Attachment:

File Name: Testing.lss
File Size:68 KB
Last edit: 1 week 19 hours ago by rajkumar_dms.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 week 18 hours ago #267887 by Joffm
Replied by Joffm on topic Custom Array
Here's your mistake
Code:
    function handleColumn(thisSelect) {
      var thisRow = $(thisSelect).closest('tr.subquestion-list');
      var item2 = $('.answer_cell_A2', thisRow);
      var item3 = $('.answer_cell_A3', thisRow);
     var x=$(thisSelect).val();
      if(x==1)  {
        $('input:text', item2).prop('disabled', false);
...

This way you also handle "x=empty"

Change it to
Code:
    function handleColumn(thisSelect) {
      var thisRow = $(thisSelect).closest('tr.subquestion-list');
      var item2 = $('.answer_cell_A2', thisRow);
      var item3 = $('.answer_cell_A3', thisRow);
     var x=$(thisSelect).val();
      if(x<2)  {
        $('input:text', item2).prop('disabled', false);
        $('input:text', item3).prop('disabled', false);
      }
      else {
...

 

Joffm

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

Please Log in to join the conversation.

  • rajkumar_dms
  • rajkumar_dms's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
1 week 17 hours ago - 1 week 16 hours ago #267889 by rajkumar_dms
Replied by rajkumar_dms on topic Custom Array
Thanks you

That question mandatory question when i select "No" then ask for responses it's should not be and allow to move next page if select
Can you added the Yes No as inline radio bottom and also notice one things when error popup and Yes/No are auto deselected it's should not be happen
Last edit: 1 week 16 hours ago by rajkumar_dms.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 week 16 hours ago - 1 week 13 hours ago #267891 by Joffm
Replied by Joffm on topic Custom Array
If the question is mandatory, you have to answer ALL cells - obviously.
That's the meaning of "mandatory"

Otherwise you have to validate the question,
So check, that
ALL A1 are filled, A2 & A3 are filled if A1==1

Joffm

BTW: The question validation could be like this

(countif("1",self.sq_A1.NAOK)==count(self.sq_A2.NAOK)) and (countif("1",self.sq_A1.NAOK)==count(self.sq_A3.NAOK)) and count(self.sq_A1.NAOK)==sum(count(that.Q1.sq_1)*4,count(that.Q1.sq_2)*4,count(that.Q1.sq_3)*4,count(that.Q1.sq_4)*4,count(that.Q1.sq_5)*4)

and the validation tip (of course, it's up to you)
{if((countif("1",self.sq_A1.NAOK)!=count(self.sq_A2.NAOK)) or (countif("1",self.sq_A1.NAOK)!=count(self.sq_A3.NAOK)),'If you answered "Yes", please fill the whole row',if(count(self.sq_A1.NAOK)!=sum(count(that.Q1.sq_1)*4,count(that.Q1.sq_2)*4,count(that.Q1.sq_3)*4,count(that.Q1.sq_4)*4,count(that.Q1.sq_5)*4),'Please, answer each row!',''))}




Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 1 week 13 hours ago by Joffm.

Please Log in to join the conversation.

  • rajkumar_dms
  • rajkumar_dms's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
5 days 21 hours ago #267925 by rajkumar_dms
Replied by rajkumar_dms on topic Custom Array
Thanks for the solutions

Can you show the question side by side that means 1st i will show the Q1 1st then the right of the questions Q1 i will show Q2

is it possible in this

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 days 18 hours ago #267929 by Joffm
Replied by Joffm on topic Custom Array
You can do that.
 
But as I think it a real poor idea, I only say:
Search the forum for "flex-layout"

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

Please Log in to join the conversation.

Moderators: holchtpartner

Lime-years ahead

Online-surveys for every purse and purpose