Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:
  • Seite:
  • 1
  • 2

THEMA: Array num with radio in last column

Array num with radio in last column 3 Monate 2 Wochen her #103172

  • MikeConom
  • MikeConoms Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 33
  • Dank erhalten: 1
  • Karma: 0
When i choose the r1 (radio button) then the next question to be visible
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Array num with radio in last column 3 Monate 2 Wochen her #103204

  • tpartner
  • tpartners Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 3844
  • Dank erhalten: 690
  • Karma: 330
Okay, the way that I would handle that would be to supplement the listener on the radios to load their value into the hidden text inputs when clicked (I suspect you want that anyway). Then you can fire the fixnum_checkconditions() function as discussed previously.
<script type="text/javascript" charset="utf-8">$(document).ready(function() {
 
		// Identify this question
		var qID = {QID};
		var thisQuestion = $('#question'+qID);
 
		// Define the select element (radio)
		var select1 = '<div id="insertedRadio"> \
		<input type="radio" title="ans_1" value="1" name="Radio1" /> \
		</div>';
		var select2 = '<div id="insertedRadio"> \
		<input type="radio" title="ans_2" value="2" name="Radio1" /> \
		</div>';
 
		// Hide the text inputs
		$('#question'+qID+' .answer_cell_005 input[type="text"]').addClass('hidden').hide();
		$('#question'+qID+' .answer_cell_006 input[type="text"]').addClass('hidden').hide();
 
		// Insert the select elements
		$('#question'+qID+' .answer_cell_005').append(select1);
		$('#question'+qID+' .answer_cell_006').append(select2);
 
		// Listener on the radios
		$('tr.subquestions-list input[type="radio"]', thisQuestion).click(function(event) {
			var thisRow = $(this).closest('tr.subquestions-list');
			var thisCell = $(this).closest('td.question-item');
			var thisTextInput = $('input[type="text"]', thisCell);
			$('input[type="text"]', thisRow).val('');
			$('input[type="text"]', thisCell).val($(this).attr('value'));
			// Check conditions...
			checkThisRowConditions(thisRow)
		});
 
		// Keyup listener on the text inputs
		$('tr.subquestions-list input[type="text"]', thisQuestion).keyup(function(event) {
			if($(this).val() != ''){
				var thisRow = $(this).closest('tr.subquestions-list');
				$('input[type="radio"]', thisRow).attr('checked', false);
				$('input[type="text"].hidden', thisRow).val('');
				// Check conditions...
				checkThisRowConditions(thisRow)
			}
		});
 
		// Paste listener on the text inputs
		$('tr.subquestions-list input[type="text"]', thisQuestion).bind('paste', function () {
			var thisInput = $(this);		
			setTimeout(function() {	 // Little timeout so the val() is available
				if($(thisInput).val() != ''){
					var thisRow = $(thisInput).closest('tr.subquestions-list');
					$('input[type="radio"]', thisRow).attr('checked', false);
					$('input[type="text"].hidden', thisRow).val('');
					// Check conditions...
					checkThisRowConditions(thisRow)
				}
			}, 100);
		});
 
		function checkThisRowConditions(thisRow) {
			$('input[type="text"]', thisRow).each(function(i) {
				fixnum_checkconditions($(this).attr('value'), $(this).attr('name'), $(this).attr('type'));
			});
		}
	});
</script>

Dateianhang:

Dateiname: limesurvey_survey_685454.lss
Dateigröße: 20 KB
Cheers,
Tony Partner

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

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Folgende Benutzer bedankten sich: MikeConom

Array num with radio in last column 3 Monate 2 Wochen her #103236

  • MikeConom
  • MikeConoms Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 33
  • Dank erhalten: 1
  • Karma: 0
Ok Tony

this is the solution and its working fine

Also i have added a new line in section Listener on the radios
$('input[type="text"]', thisTextInput).val($(this).attr('value'));
so keep in results the value of radio

Thanks
Der Administrator hat öffentliche Schreibrechte deaktiviert.
  • Seite:
  • 1
  • 2
Moderatoren: ITEd
Ladezeit der Seite: 0.140 Sekunden
Donation Image