Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Array num with radio in last column

Array num with radio in last column 7 months 1 day ago #102751

  • MikeConom
  • MikeConom's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 39
  • Thank you received: 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
Attachments:
The administrator has disabled public write access.

Array num with radio in last column 7 months 1 day ago #102754

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4049
  • Thank you received: 739
  • Karma: 341
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.

File Attachment:

File Name: limesurvey_survey_665833.lss
File Size: 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.
Last Edit: 7 months 1 day ago by tpartner.
The administrator has disabled public write access.

Array num with radio in last column 7 months 1 day ago #102756

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4049
  • Thank you received: 739
  • Karma: 341
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.
The administrator has disabled public write access.
The following user(s) said Thank You: MikeConom

Array num with radio in last column 7 months 1 day ago #102763

  • MikeConom
  • MikeConom's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 39
  • Thank you received: 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
The administrator has disabled public write access.

Array num with radio in last column 7 months 1 day ago #102764

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4049
  • Thank you received: 739
  • Karma: 341
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.
The administrator has disabled public write access.

Array num with radio in last column 7 months 22 hours ago #102770

  • MikeConom
  • MikeConom's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 39
  • Thank you received: 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
Attachments:
The administrator has disabled public write access.

Array num with radio in last column 7 months 16 hours ago #102779

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4049
  • Thank you received: 739
  • Karma: 341
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>


File Attachment:

File Name: limesurvey_survey_6854541.lss
File Size: 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.
Last Edit: 7 months 16 hours ago by tpartner.
The administrator has disabled public write access.
The following user(s) said Thank You: MikeConom

Array num with radio in last column 7 months 14 hours ago #102796

  • MikeConom
  • MikeConom's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 39
  • Thank you received: 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
The administrator has disabled public write access.

Array num with radio in last column 6 months 2 weeks ago #103161

  • MikeConom
  • MikeConom's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 39
  • Thank you received: 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
Attachments:
The administrator has disabled public write access.

Array num with radio in last column 6 months 2 weeks ago #103169

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4049
  • Thank you received: 739
  • Karma: 341
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.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.156 seconds
Donation Image