Tipo de pregunta ARRAY

More
1 week 6 days ago #201987 by brauliofirpo77
Estimados, buenos dias

Tengo que hacer una pregunta del tipo array numerico, pero con las siguientes condiciones

1. el primer campo debe ser numerico
2. el segundo debe ser un desplegable
3. la suma de todos los valores que estan en la primera columna, debe ser siempre = 100%

Con respecto al primer y tercer punto, ya lo tengo medianamente resuelto, pero no le encuentro la manera para resolver el segundo.

Alguien tiene una idea?

Muchas gracias!

Please Log in to join the conversation.

LimeSurvey Partners
More
1 week 6 days ago #201997 by Joffm
Replied by Joffm on topic Tipo de pregunta ARRAY
Asi?



Mañana mas.

Joffm


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

Please Log in to join the conversation.

More
1 week 5 days ago #202003 by brauliofirpo77
Exacto.

Please Log in to join the conversation.

More
1 week 5 days ago #202014 by Joffm
Replied by Joffm on topic Tipo de pregunta ARRAY
Hola,

bueno, aqui el javascript
<script type="text/javascript" charset="utf-8">
	$(document).on('ready pjax:scriptcomplete',function(){
		var thisQuestion = $('#question{QID}');
 
		// Insert selects
		$('.answer-item.answer_cell_X002', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
													<option value="">...</option>\
													<option value="1">Opcion 1</option>\
													<option value="2">Opcion 2</option>\
													<option value="3">Opcion 3</option>\
													<option value="4">Opcion 4</option>\
												</select>'); 
 
		// Listeners
		$('.inserted-select', thisQuestion).on('change', function(i) {
			if($(this).val() != '') {
				$(this).closest('.answer-item').find('input:text').val($.trim($('option:selected', this).text())).trigger('change');
			}
			else {
				$(this).closest('.answer-item').find('input:text').val('').trigger('change');
			}
		});
 
		// Returning to page
		$('.with-select input:text', thisQuestion).each(function(i) {
			var thisCell = $(this).closest('.answer-item');
			var inputText = $.trim($(this).val());
			var selectval = $('select.inserted-select option', thisCell).filter(function () { return $(this).html() == inputText; }).val();
			$('select.inserted-select', thisCell).val(selectval);
		});
 
		// Clean-up styles
		$('select.inserted-select', thisQuestion).css({
			'max-width': '100%'
		});
		$('.with-select input:text', thisQuestion).css({
			'position': 'absolute',
			'left': '-9999em'
		});
	});
</script>

y el ejemplo.

File Attachment:

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


Mira la ecuación de validación.

Joffm


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

Please Log in to join the conversation.

More
1 week 4 days ago #202096 by brauliofirpo77
muchas gracias!

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now