Adding textbox in basic array

More
2 months 2 weeks ago #197697 by Chrisou
This is probably a very basic question, but how do I import or open this in LS?

Thanks for the tip, I have version 3.22.12.

Please Log in to join the conversation.

More
2 months 2 weeks ago #197699 by holch
Replied by holch on topic Adding textbox in basic array
yes, this is very, very, very, very basic.


I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Attachments:
The following user(s) said Thank You: Chrisou

Please Log in to join the conversation.

More
2 months 2 weeks ago #197703 by Chrisou
Thank you both very much, I should be able to figure this out now (hopefully) :)

Please Log in to join the conversation.

More
2 months 2 weeks ago #197755 by Chrisou
I'm happy to report that I have successfully added the script to all my questions and the text box is showing as it should - again, thank you so much!

However, I forgot an important detail: I'd like to randomise my questions, while showing them all on the same page.
Therefore, I put everything in the same question group, but now I'm wondering if the comment boxes will appear with the right questions?

Please Log in to join the conversation.

More
2 months 2 weeks ago #197756 by Joffm
Replied by Joffm on topic Adding textbox in basic array

but now I'm wondering if the comment boxes will appear with the right questions?

Do they? Or not?
Try. Activate the survey, enter some well defined data, and then check the answer table.

Joffm


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

Please Log in to join the conversation.

More
2 months 2 weeks ago #197764 by Chrisou
It's all a big mess.

If I put everything in the same randomisation group, LS will sometimes put two "comment boxes" together to create something like you see attached. If I only randomise the actual questions, they will randomise, but the comments stay in the order I put them in originally
Attachments:

Please Log in to join the conversation.

More
2 months 2 weeks ago #197785 by DenisChenu
This topic is to big to be readed … and title seems not related to randomization

Maybe time to create own topic ?

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development . I don't answer to private message.

Please Log in to join the conversation.

More
1 day 10 hours ago #202525 by kratugoel
Hi

I was wondering if we could add one large comment box for the entire question as opposed to each row. I see most responses for adding a comment box to each row but couldn't find one for just one box for the question. Could I get some assistance on this?

I am using Version 3.22.24+200630.

Thank you

Please Log in to join the conversation.

More
1 day 10 hours ago #202528 by Joffm
Replied by Joffm on topic Adding textbox in basic array
Something like this?

Use two questions and adapt the css.

In this example I used the skelvanilla theme.

Here the necessary classes are built in.

And here fruity

with these settings.
I gave the array question a css class "myarray" and the text question a css class "mytext"
<style type="text/css">.mytext .question-title-container, .mytext .question-valid-container {
  display:none;}
.myarray .question-container {
    margin-bottom: 0em;
}
</style>


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

Please Log in to join the conversation.

More
1 day 9 hours ago #202534 by kratugoel
Thank you for the quick response. Was hoping to actually have a comment box template like the one shared here which leads to a pop-up text box. Is that possible? This would work well otherwise. Thank you

Please Log in to join the conversation.

More
1 day 9 hours ago - 1 day 9 hours ago #202535 by DenisChenu

Joffm wrote: In this example I used the skelvanilla theme.

I muts create more saple with SkelVanilla,

In fact it's included in Css class

1st question must have `skel-start-group-question` class
Next questions can have (must ?) skel-wrap-none
Last question must have ``skel-end-group`

This can make something like this easily


extensions.sondages.pro/themes-and-templ...b-group-inside-group

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development . I don't answer to private message.
Attachments:
Last edit: 1 day 9 hours ago by DenisChenu. Reason: img didn't work

Please Log in to join the conversation.

More
1 day 7 hours ago #202551 by Joffm
Replied by Joffm on topic Adding textbox in basic array
If you want something like a popup, please say it.
There is, as far as I remember, a solution with a button - you need something to trigger it.


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

Please Log in to join the conversation.

More
1 day 5 hours ago #202555 by kratugoel
I am not sure how do I trigger it? Would you have any suggestions or links to the solution for that? Apologies if my initial message wasn't clear. I would like to present the pop-up to my team as an added bonus.

Thank you for your help

Please Log in to join the conversation.

More
16 hours 14 minutes ago - 16 hours ago #202567 by Joffm
Replied by Joffm on topic Adding textbox in basic array
Hi,you already found this solution, didn't you?
https://forums.limesurvey.org/forum/can-i-do-this-with-limesurvey/100261-combined-array-with-large-free-text-comment-fields?start=15

I adapted the script by removing everything related to the array rows, put the button into the question text and got:




First the button (a simple bootstrap button):
<button class="btn btn-default btn-xs" data-backdrop="static" data-keyboard="false" data-target="#comments-{QID}-1" data-toggle="modal" type="button">Click to add a comment</button>

and the script:
<script type="text/javascript" charset="utf-8">
 
	$(document).on('ready pjax:scriptcomplete',function(){
 
		// Identify the questions
		var qArrayID = {QID};
		var qArray = $('#question'+qArrayID);
		var arrayLength = $('tr.answers-list', qArray).length;
		var qComments = qArray.nextAll('.text-long:lt('+arrayLength+')');
 
 
		// Add some classes
		qArray.addClass('array-with-comments-question');
		$(qComments).each(function(i) {
			$(this).addClass('comments-question index-'+i).css({
				'position': 'absolute',
				'left': '-9999em'
			});
		});
 
		// Handle comments
		$(qComments).each(function(i) {
			// Create modals
			$('body').append('<div class="modal comments-modal" id="comments-'+qArrayID+'-'+(i+1)+'" tabindex="-1" role="dialog">\
								<div class="modal-dialog" role="document">\
									<div class="modal-content">\
										<div class="modal-header">\
											<h5 class="modal-title">'+$('.ls-label-question', this).html()+'</h5>\
										</div>\
										<div class="modal-body">\
										</div>\
										<div class="modal-footer">\
											<button type="button" class="btn btn-primary" data-dismiss="modal">Okay</button>\
											<button type="button" class="btn btn-secondary" data-dismiss="modal">Clear</button>\
										</div>\
									</div>\
								</div>\
							</div>');
 
			// Move textareas into modals
			$('#comments-'+qArrayID+'-'+(i+1)+' .modal-body').append($('textarea', this));
 
			// Modal button events
			$('#comments-'+qArrayID+'-'+(i+1)+' .modal-footer .btn-secondary').on('click', function(e) {
				$('#comments-'+qArrayID+'-'+(i+1)+' textarea').val('');
			});
 
		});
 
		// Interrupt the Next/Submit function (to put comments back in the form)
		$('#limesurvey').submit(function(e) {
			$('.comments-modal[id^="comments-'+qArrayID+'-"]').each(function(i) {
				var qID = $('textarea:eq(0)', this).attr('id').split('X')[2];
				$('#question'+qID+' .answer-item:eq(0)').append($('textarea:eq(0)', this));
			});
		});	
	});
</script>

File Attachment:

File Name: limesurvey...5391.lss
File Size:22 KB


Joffm

The script can be simplified more ( there is only one comment); so no need to use the each-function.
But I am not familiar at all with javascript. It's only Amateurishness.


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
Last edit: 16 hours ago by Joffm.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now