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

THEMA: Array num with radio in last column

Array num with radio in last column 10 Monate 2 Stunden her #102751

  • MikeConom
  • MikeConoms Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 39
  • Dank erhalten: 1
  • Karma: 0
Good evening

i have create an array with numbers and in the end a radio button

i am looking to find how can i do the following

1) When choosing radio button numeric fields to be 0
2) when I write in numeric fields the radio buttons to be not check

Thanks
Anhang:
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Array num with radio in last column 9 Monate 4 Wochen her #102754

  • tpartner
  • tpartners Avatar
  • ONLINE
  • LimeSurvey Team
  • Beiträge: 4266
  • Dank erhalten: 803
  • Karma: 368
This should do the trick. Note that this code must be placed after your code that inserts the radios.

<script type="text/javascript" charset="utf-8">	
 
	$(document).ready(function(){
 
		// Identify this question
		var thisQuestion = $('#question{QID}');
 
		// Listener on the radios
		$('tr.subquestions-list input[type="radio"]', thisQuestion).click(function(event) {
			var thisRow = $(this).closest('tr.subquestions-list');
			$('input[type="text"]', thisRow).val('');
		});
 
		// 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);
			}
		});
 
		// 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);
				}
			}, 100);
		});
	});
</script>

Here is the survey back with the amended code.

Dateianhang:

Dateiname: limesurvey_survey_665833.lss
Dateigröße: 17 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.
Letzte Änderung: 9 Monate 4 Wochen her von tpartner.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Array num with radio in last column 9 Monate 4 Wochen her #102756

  • tpartner
  • tpartners Avatar
  • ONLINE
  • LimeSurvey Team
  • Beiträge: 4266
  • Dank erhalten: 803
  • Karma: 368
I should point out that I assumed you are using LS 2.0.

If using 2.05,the code would be slightly different:
<script type="text/javascript" charset="utf-8">	
 
	$(document).ready(function(){
 
		// Identify this question
		var thisQuestion = $('#question{QID}');
 
		// Listener on the radois
		$('tr.subquestions-list input[type="radio"]', thisQuestion).click(function(event) {
			var thisRow = $(this).closest('tr.subquestions-list');
			$('input[type="text"]', thisRow).val('');
		});
 
		// 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).prop('checked', false);
			}
		});
 
		// 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).prop('checked', false);
				}
			}, 100);
		});
	});
</script>
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 9 Monate 4 Wochen her #102763

  • MikeConom
  • MikeConoms Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 39
  • Dank erhalten: 1
  • Karma: 0
Partner thanks for your support.
As i see the different betwwen LS 2.0 and 2.5 is the .prop and .attr
That means when i have to change version i have to take care for this different.

Thanks
Mike Conom
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Array num with radio in last column 9 Monate 4 Wochen her #102764

  • tpartner
  • tpartners Avatar
  • ONLINE
  • LimeSurvey Team
  • Beiträge: 4266
  • Dank erhalten: 803
  • Karma: 368
Yes, in jQuery 1.6.1 the .prop() method was introduced and replaced several uses of the .attr() method (and pissed off LOTS of developers) - blog.jquery.com/2011/05/12/jquery-1-6-1-released/
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.

Array num with radio in last column 9 Monate 4 Wochen her #102770

  • MikeConom
  • MikeConoms Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 39
  • Dank erhalten: 1
  • Karma: 0
Partner good morning

I have a hidden question and depence from the days.
when the days are Greater than 3 then the hidden question appear.
When i press the radio button and the days is empty, the question is still visible.
i tried with many methods like focus in days and press backspace or put number less than 3
but i cant find solution.

have you a solution for this?

Thanks
Anhang:
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Array num with radio in last column 9 Monate 4 Wochen her #102779

  • tpartner
  • tpartners Avatar
  • ONLINE
  • LimeSurvey Team
  • Beiträge: 4266
  • Dank erhalten: 803
  • Karma: 368
In that case, you will need to fire the fixnum_checkconditions() function for all text inputs in a row when a radio is clicked.

<script type="text/javascript" charset="utf-8">	
 
	$(document).ready(function(){
 
		// Identify this question
		var thisQuestion = $('#question{QID}');
 
		// Listener on the radois
		$('tr.subquestions-list input[type="radio"]', thisQuestion).click(function(event) {
			var thisRow = $(this).closest('tr.subquestions-list');
			$('input[type="text"]', thisRow).val('');
			// Check conditions...
			$('input[type="text"]', thisRow).each(function(i) {
				fixnum_checkconditions($(this).attr('value'), $(this).attr('name'), $(this).attr('type'));
			});
		});
 
		// 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).prop('checked', false);
			}
		});
 
		// 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).prop('checked', false);
				}
			}, 100);
		});
	});
</script>


Dateianhang:

Dateiname: limesurvey_survey_6854541.lss
Dateigröße: 19 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.
Letzte Änderung: 9 Monate 4 Wochen her von tpartner.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Folgende Benutzer bedankten sich: MikeConom

Array num with radio in last column 9 Monate 4 Wochen her #102796

  • MikeConom
  • MikeConoms Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 39
  • Dank erhalten: 1
  • Karma: 0
It was my first step when i was looking for the solution, but i forgot to execute each(function(i)

Have a nice evening

Thanks
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Array num with radio in last column 9 Monate 1 Woche her #103161

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

My best wishes for a happy new year.

Is it possible to check the radio button for the next question?

I have try with many conditions but i cant find the solution.

Thanks
Anhang:
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Array num with radio in last column 9 Monate 1 Woche her #103169

  • tpartner
  • tpartners Avatar
  • ONLINE
  • LimeSurvey Team
  • Beiträge: 4266
  • Dank erhalten: 803
  • Karma: 368
Sorry, I don't understand the question.
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.
  • Seite:
  • 1
  • 2
Moderatoren: ITEd
Ladezeit der Seite: 0.173 Sekunden
Donation Image