Welcome to the LimeSurvey Community Forum

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

creating a table using javascript and the options are based previous answer

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 7 months ago - 1 year 7 months ago #232387 by Joffm
Hi, sorry for delay.
What are these circles? 
Are these radio buttons?

And the table below. What will be inserted there?
Some fixed text or text from previous answers or input fields?

As this is a normal HTML table I do not see anything why it shouldn't work.


BUT: What do you want to ask here?
What are the respondents to answer?

Joffm
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 1 year 7 months ago by Joffm.

Please Log in to join the conversation.

  • qiangqi
  • qiangqi's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
1 year 6 months ago #232421 by qiangqi
Hi Joffm,

I have designed a table, as shown in the picture in attachment, but it has several problems I don't know how to deal with. I want to show the red box to respondent firstly and only when respondent choose a mode in the red box, the rest part would appear. So, the first question is how i could do this except setting if-statement in each cell generation. I tried to use <div> to make the rest part as a block, but it doesn't work.

When the whole picture is shown, respondent could re-select a mode in the bottom of the picture and the option description is based on the choice in the red box and I have give a example using If-Statement in the list of Answer Option. the problem of re-selecting is that everytime i select a option in the red box, it will show the corresponding option description, but actually, I want it hide, as shown in picture.  

and the last question, as you see, the buttons are not in the center of a cell, although i use the script that you told Shangqi before, as shown below, but it doesn't work.
<style type="text/css">.dir-ltr .radio-item .ls-label-xs-visibility, .dir-ltr .checkbox-item .ls-label-xs-visibility {
    left: auto;
    margin-left: 0px;
}
</style>

Thanks for your help.
Best wishes,
Qiang   

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 6 months ago #232425 by Joffm
Hi,
1. this question is quite different from your initial question of this thread.
You dhould have opened a new thread.
Unfortunately this happens many times and therefore we read quite often "I searched the forum but I did not find". Not very surprising with such misleading topics.

2.

I have designed a table, as shown in the picture in attachment, but it has several problems I don't know how to deal with. I want to show the red box to respondent firstly and only when respondent choose a mode in the red box, the rest part would appear. So, the first question is how i could do this except setting if-statement in each cell generation. I tried to use <div> to make the rest part as a block, but it doesn't work.

Did you consider to use two questions merged with classes ".no-bottom" and ".no-question".
You'll find them somewhere in the forum.

3.

When the whole picture is shown, respondent could re-select a mode in the bottom of the picture and the option description is based on the choice in the red box and I have give a example using If-Statement in the list of Answer Option. the problem of re-selecting is that everytime i select a option in the red box, it will show the corresponding option description, but actually, I want it hide, as shown in picture. 


I do not understand.
and the option description is based on the choice in the red box
everytime i select a option in the red box, it will show the corresponding option description
So what do you want?
Is the description shown or not?

And to be honest, I do not understand the image without box.
"Ride-hailing" is selected.
Now the question is "Do you want to re-select...?" with answer options "No" and "keep ride hailing"
Wouldn't it be better to insert the transportation mode into the question "Do you want to re-select ride-hailing?" anser options "Yes" and "No"?

and the last question, as you see, the buttons are not in the center of a cell, although i use the script that you told Shangqi before, as shown below, but it doesn't work.


Unfortunately I cannot check anything.
Never provide lsq nor lsg exports, only lss.

Joffm

But one general word:
Split the question. Simplify it.
Your respondents will be grateful.

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

Please Log in to join the conversation.

  • qiangqi
  • qiangqi's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
1 year 6 months ago #232458 by qiangqi
Hi Joffm,

the aim of survey is to know if people want to take a parcel for others on their way to destination. so ,first, people choose transport modes without an available parcel. after that, I will show them a parcel information and they could decide if they want to accept the parcel and change a mode to destination. so, this is why I use two parts. in terms of the re-select options, other modes also should be included, so the options are not just ride-hailing and no.

i have seen the method using two questions merged with classes ".no-bottom" and ".no-question". but because i use  a group account,  I can't change the css class. therefore, I try to use if-statement to generate the second part. I use the question of "re-select a mode" as an experience, but the question appears anyway. you could see the if-statement in the figure below and you could see the lss file.

Thanks for your help.

Best wishes,
Qiang
 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 6 months ago #232539 by Joffm
Hi,
1.

I can't change the css class.

Of course you can.
You can enter it into the question text as you do with otherf css-snippets.

Here is something I created with your previous screenshot and your "second" page.
I captured the images from the screen.

First you see only the upper part


After you selected a transportation mode the second part (the second question) gets visible
 


How can I understand this question?
Do you want to take a parcel and re-select a transportation mode?

YES, I want to take a parcel and NO I don't want to re-select.
What do I click? YES or NO?

Or are there radio buttons to select one of the packages  OR "No"?

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

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 6 months ago - 1 year 6 months ago #232556 by Joffm
By the way:
If you change the equation "numberofprivatemode" to 
{2*(intval(ptransportmode_PT1=="Y")+intval(ptransportmode_PT2=="Y")+intval(ptransportmode_PT3=="Y"))+7}
there is this IF sequence in the table
<td class="tdf" colspan="{if(numberofprivatemode=='3','13',if(numberofprivatemode=='2','11',if(numberofprivatemode=='1','9','7')))}" ...
not necessary. You already have the correct value.
<td class="tdf" colspan="{numberofprivatemode}" ...

It is always better to calculate things only once.
And are these long variable names really necessary and also the doubling with the subquestion code "PTx"?

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 1 year 6 months ago by Joffm.

Please Log in to join the conversation.

  • qiangqi
  • qiangqi's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
1 year 6 months ago #232557 by qiangqi
Hi Joffm,

I copied the command of no.question and no.bottom in my survey, but it doesn't work. besides, the choice button in the second part also don't appear. I don't know why these problems occur.  You could see them in the .lss file in attachment. 

for the question of "re-select mode", actually, the parcel 1 could only be choose when you choose mode of yellow column and parcel 2 for blue column. so, I think the options should be 4, No, take package 1 and keep chosen mode, take package 1 and re-select mode, take package 2 and re-select mode. when one of the last two is chosen, a new question choosing modes would appear.

Best wishes,
Qiang

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 6 months ago - 1 year 6 months ago #232558 by Joffm
You did no add these css classes to the questions in "css classes".
Did you read the manual? At least "question types" and "ExpressionScript"
[url] manual.limesurvey.org/Question_type_-_Ar...lass_.28css_class.29 [/url]

And , obviously, you can't use "no-question", because than you would hide everything as you placed the table into the question text.
So "no-bottom" in the first array

If you want to remove the small white space between the two arrays, use the webdevelopment tool to find the affected classes.

And set the condition of table77 to "!is_empty(that.table55.sq_SQ001)" as you want to display it after a mode in table55 was selected.

 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 1 year 6 months ago by Joffm.

Please Log in to join the conversation.

  • qiangqi
  • qiangqi's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
1 year 6 months ago #232571 by qiangqi
Hi Joffm,

I use webdevelopment tool to find the affected classes and I try to delete them, but the result is all contents including the first part are deleted. so, could u tell me how to solve the problem?
<style type="text/css">.question-valid-container{
 display: none;
}
  .text-info{
 display: none;
}
  .col-xs-12  {
 display: none;
}
</style>

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 6 months ago #232583 by Joffm
1. You have to look for the "question-title-container".
Here all your stuff is inserted.
The "question-valid-container" is a container for error messages.

I created two new classes
"padtop0" (padding-top set to "0")
"padbot0" (padding-bottom set to "0")

So "padbot0" in the first question,
"padtop0" in the second question.

Code:
.padtop0 .question-title-container {
    padding-top: 0em;
}
.padtop0 .table {
    margin-bottom: 10px;
}
.padbot0 .question-title-container {
    padding-bottom: 0em;
}
.padbot0 .table {
    margin-bottom: 0px;
}


By the way:
What do you imagine to happen in this question?
First I select "tram"
Then I agree to take a parcel of 4kg, but I want to re-select because I can't carry a parcel of that weight and I am going to do the trip with my bakviets.
But you said "and parcel 2 for blue column".
But now I have "parcel 2 and yellow column".
You have to consider this. I think, the best solution is not to limit this (up to the respondents)

Anyway: Do you really think anybody will change his selected transportmode, only bacause he agrees to deliver a parcel? I do not.

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

Please Log in to join the conversation.

  • qiangqi
  • qiangqi's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
1 year 6 months ago #232588 by qiangqi
Hi Joffm,

it works! thanks for your help.

from the second part, you could see "detour riding time" and "extra walking time", and the former is just for modes except tram and bus, and latter is for the two modes.so, it is impossible to choose parcel 1 and tram.

besides, if you want to choose a parcel, the extra riding time and cost are different for modes. it is possible that you could earn more money and spend less extra time if you change a mode. but i know it is also possible some persons are lazy to choose another mode when answer the questionnaire. it may be better to show the two parts together and let respondent to choose a mode. But i also want to know whether adding a parcel could have impact for persons choosing a mode compared to normal choice of mode. so, do you have some better advice for this? thanks in advance.

best wishes,
Qiang

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 6 months ago #232590 by Joffm

 if you want to choose a parcel, the extra riding time and cost are different for modes. it is possible that you could earn more money and spend less extra time if you change a mode

There is extra riding time, and extra cost. I really doubt that many people will change their mind for a small benefit.

but i know it is also possible some persons are lazy to choose another mode when answer the questionnaire.

Not only when answering a questionnaire, in real life.

But it doesn't matter.
You will get your results and you will analyse them.

 



 

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

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose