Array question with answers in dropdown boxes

More
2 years 3 weeks ago #137953 by DenisChenu
DenisChenu replied the topic: Array question with answers in dropdown boxes

Juanoche wrote:

DenisChenu wrote: Hi,

Actually for such solution : you have a plugin : www.limesurvey.org/forum/plugins/104019-...ith-dropdwon-or-mask

It work on a 2.50 last time i tested.


DenisChenu I had already seen that plugin but unfortunately I get a 500 error on my server when I install it and try to acces survey settings / Plugins

See github.com/SondagesPro/LS-arrayTextAdapt...suecomment-223626556

I can not reproduce the issue : then need tester.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in or Create an account to join the conversation.

More
1 year 8 months ago #143401 by ramzus
ramzus replied the topic: Array question with answers in dropdown boxes
Hi tpartner,

I used this solution and it was very helpful, but now i want to show the selected dropdown text in the next question but the Limesurvey replacement field properties shown only the code selected.

Thanks

Please Log in or Create an account to join the conversation.

More
1 year 8 months ago #143406 by tpartner
tpartner replied the topic: Array question with answers in dropdown boxes
Err...which solution. There are many in this thread, some of which are years old. It may be better to start a new thread describing exactly what you did and the details of your LimeSurvey environment.

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

Please Log in or Create an account to join the conversation.

More
1 year 8 months ago #143413 by ramzus
ramzus replied the topic: Array question with answers in dropdown boxes
The solution for the array question with text answers in a dropdown box i want to show the selected dropdown text in the next question but the Limesurvey replacement field properties shown only the code selected.
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function(){
 
        $('#questionQQ .answer_cell_001 option[value=1]').text('No recurro');
        $('#questionQQ .answer_cell_001 option[value=2]').text('Arocena Gustavo');
        $('#questionQQ .answer_cell_001 option[value=3]').text('Aspra Manuel');
        $('#questionQQ .answer_cell_001 option[value=4]').text('Bravo Ricardo');
        $('#questionQQ .answer_cell_001 option[value=5]').text('Zalazar Martin');
 
        $('#questionQQ .answer_cell_002 option[value=1]').text('No recurro');
        $('#questionQQ .answer_cell_002 option[value=2]').text('Bravo Ricardo');
        $('#questionQQ .answer_cell_002 option[value=3]').text('Fernandez Flavio');
        $('#questionQQ .answer_cell_002 option[value=4]').text('Zalazar Martin');
        $('#questionQQ .answer_cell_002 option[value=5]').text('').hide();
 
    });

Please Log in or Create an account to join the conversation.

More
1 year 8 months ago #143424 by tpartner
tpartner replied the topic: Array question with answers in dropdown boxes
In that case, you would either need to use Expression Manager to pipe in the text depending on the code or use Denis' arrayTextAdapt plugin .

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

Please Log in or Create an account to join the conversation.

More
1 year 8 months ago #143436 by ramzus
ramzus replied the topic: Array question with answers in dropdown boxes
Thank you very much, i will try this

Please Log in or Create an account to join the conversation.

More
3 weeks 4 days ago #170145 by b1994mi
b1994mi replied the topic: Array question with answers in dropdown boxes
Hi,

I have been using tpartner's javascript for providing dropdown options on array (texts). But, now I need something a bit specific. I need to make certain row readonly and force an answer that is different from the options provided by the dropdown.

What the respondents will think is that this readonly inputs are fixed because they need to use MRT for that journey.

Here is the mockup of what I need:
Warning: Spoiler! [ Click to expand ]


I have attached my survey file with only the corresponding question group.
Attachments:

Please Log in or Create an account to join the conversation.

More
3 weeks 3 days ago #170227 by tpartner
tpartner replied the topic: Array question with answers in dropdown boxes
I don't think it's possible with a single array question as your "MRT" row is a moving target depending on the answers to the first two questions. I would do it with three array questions, styled with CSS to appear as one.

- One array for modes getting to MRT
- One (readonly) array for MRT
- One array for modes getting from MRT

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

Please Log in or Create an account to join the conversation.

More
3 weeks 3 days ago #170232 by b1994mi
b1994mi replied the topic: Array question with answers in dropdown boxes
Hi,

I have found this thread and it is about two radio button question merged into one.

How to call the previous question? (assuming that I place the MRT in the middle)

Or is there any exact thread you can refer? It is a bit too complicated for me to implement the CSS :(

Thank you in advance.

Please Log in or Create an account to join the conversation.

More
3 weeks 3 days ago #170236 by tpartner
tpartner replied the topic: Array question with answers in dropdown boxes
It would be far easier to do it with CSS but the details would depend on your LimeSurvey version and theme.

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

Please Log in or Create an account to join the conversation.

More
3 weeks 2 days ago #170276 by b1994mi
b1994mi replied the topic: Array question with answers in dropdown boxes
Hi,

My Limesurvey version is Version 3.6.2+180406 and the theme is fruity. Is there any thing that I should notice if I ever needed the workaround to be done on another version and theme?

Thank you in advance.

Please Log in or Create an account to join the conversation.

More
3 weeks 2 days ago #170278 by tpartner
tpartner replied the topic: Array question with answers in dropdown boxes
- Assign Q1 a CSS class "merge-bottom".
- Assign Q2 CSS classes "merge-top merge-bottom".
- Assign Q3 a CSS class "merge-top".

Add something like this to custom.css in your extended theme:

.question-container.merge-bottom {
    margin-bottom: 0;
    border-bottom: 0 none;
}
 
.question-container.merge-bottom .answer-container {
    padding-bottom: 0;
}
 
.question-container.merge-top,
.question-container.merge-top .subquestion-list,
.question-container.merge-top .subquestion-list tbody tr:first-child > * {
    border-top: 0 none;
}
 
.question-container.merge-top .answer-container {
    padding-top: 0;
}
 
.question-container.merge-top .question-title-container,
.question-container.merge-top .question-valid-container,
.question-container.merge-top .subquestion-list thead {
	display: none;
}



Regarding other themes - you would need to explore the HTML and CSS affecting the layout to determine what is required.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:

Please Log in or Create an account to join the conversation.

More
2 weeks 5 days ago #170411 by b1994mi
b1994mi replied the topic: Array question with answers in dropdown boxes
Hi,

Thank you, it worked. But, a new problem arises. I need to force input the array fields. :(

So far I have used:
{middle_1_SQ001="MRT"}
{middle_1_SQ002=20}
{middle_1_SQ003=8000}
to force input, but it did not work. How is so?

Here is what it looks like:
Warning: Spoiler! [ Click to expand ]


I have attached my survey file below.

Btw, I need to use 'for loop' to calculate time from one station to another and input in 'time (min)' for MRT. Should I just make a new thread or is there already a thread that asks the same question?
Attachments:

Please Log in or Create an account to join the conversation.

More
2 weeks 4 days ago #170432 by tpartner
tpartner replied the topic: Array question with answers in dropdown boxes
If you want to use Expression Manager to set answers, you must place those statements in equation type questions positioned after the array.

Having said that, you could use JavaScript to set the answers as you render the inputs readonly.

<script type="text/javascript" charset="utf-8">
	$(document).on('ready pjax:scriptcomplete',function(){
		$("#answer{SGQ}1_SQ001").val('MRT').trigger('keyup').prop("readonly",true);
		$("#answer{SGQ}1_SQ002").val(20).trigger('keyup').prop("readonly",true);
		$("#answer{SGQ}1_SQ003").val(8000).trigger('keyup').prop("readonly",true);
	});
</script>


Regarding your 'for loop' question - sorry, I have no idea what you are trying to do.

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

Please Log in or Create an account to join the conversation.

More
2 weeks 4 days ago #170438 by b1994mi
b1994mi replied the topic: Array question with answers in dropdown boxes
I see, I think this would be all that I need. I don't think the for loop is necessary anymore, so let's just forget it.

Thank you very much for your help. :)

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!