Radio button list with multiple text inputs for one of the options

Plus d'informations
il y a 5 mois 1 semaine - il y a 5 mois 1 semaine #168356 par horsti2010
horsti2010 a créé le sujet : Radio button list with multiple text inputs for one of the options
Hi everyone,

thanks for the great software and forum! I have a question regarding an issue I am currently facing while working on a survey and hope for some support here if possible.

I would need something like in the picture I attached: A radio list with two items (yes and no / none) and if the first one (yes) is selected, the user has the option to enter text (specifically: numbers only) in 2 or 3 inputs.

I know that I could do it with two seperate questions, but I really need it in one question. As there is more than 1 user input, the "other" option is not enough.

Is there any Javascript hack or idea how to solve this? Maybe creating a 2-option radio list and a separate multiple text input question that is then "hacked" into the first radio element somehow?

Thanks in advance for any help or suggestions ;-)
Pièces jointes :
Dernière édition: il y a 5 mois 1 semaine par horsti2010.

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 5 mois 1 semaine - il y a 5 mois 1 semaine #168383 par Joffm
Joffm a répondu au sujet : Radio button list with multiple text inputs for one of the options
Hi, horsti,

so you would like to have this kind of display.
Of course, you do not need it, because you know that there is a good looking alternative.

This way you can have as many text inputs as you like.
And you can improve the look by a bit more css.

Well, I can offer something that looks like your chart.








Just use a question of type "mulitple with comments", enter this script
<script type="text/javascript" charset="utf-8">
	$(document).ready(function() {
 
		// Identify this question
		var qID = {QID}; 
 
		// The sub-question codes to have no text input
		var sqCodes = [1,5]; 
 
		// Loop through those sq codes and remove their text inputs
		$(sqCodes).each(function(i, code) {
			$('#question'+qID+' input[type="text"][id$="X'+qID+code+'comment"]').remove();
		});
 
	});
</script>

and use relevance equarions to show the text inputs:
Like:
(Q1_SQ001=="Y")
(Q1_SQ001=="Y") and (!is_empty(Q1_SQ002comment))
...

Regards
Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Pièces jointes :
Dernière édition: il y a 5 mois 1 semaine par Joffm.

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 5 mois 1 semaine #168521 par horsti2010
horsti2010 a répondu au sujet : Radio button list with multiple text inputs for one of the options
Hey Joffm,

thanks for the reply and indeed, that is a way I can work around towards my requirements. That helps a lot!
Sometimes you (myself in this case) don't realise the easy solutions and try to approch it from the difficult path. Your script and some css-tuning will most likely do the trick here.

Cheers and have a great day,
horsti

Connexion ou Créer un compte pour participer à la conversation.

Commencez dès maintenant !

Créez simplement un compte et commencez à utiliser LimeSurvey dès aujourd'hui.

Inscrivez-vous maintenant

Inscrivez-vous à notre Newsletter!