Can put some value to text-style question by click radio button?

More
2 years 10 months ago #116370 by cnsla
cnsla created the topic: Can put some value to text-style question by click radio button?
Can put some value to text-style question by click radio button?

Like below.
I tried it, but didn't work.

<input type="radio" class="text empty" id="answer{SGQ}SQ001" name="{SGQ}SQ001" value="1" />

Please Log in to join the conversation.

More
2 years 10 months ago #116384 by tpartner
tpartner replied the topic: Can put some value to text-style question by click radio button?
Sorry, don't understand the question.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: cnsla

Please Log in to join the conversation.

More
2 years 10 months ago #116388 by cnsla
cnsla replied the topic: Can put some value to text-style question by click radio button?
Due to huge survey size, I gave up using 'array'. (php error happens...)
I hope to make some workaround in "multiple short texts" question type.
I want to make some radio buttons 'linked' to text input box
(i.e. when clink radio button 1, put "1" to SQ 001 text input box, when click radio button 2, erase "1" and put "2" to SQ001 text input box)

Please Log in to join the conversation.

More
2 years 10 months ago #116432 by tpartner
tpartner replied the topic: Can put some value to text-style question by click radio button?
Placing something like this in the source of the multiple-text question should load the first two inputs. Of course, you will need to replace "input.my-radio-class" and "input.another-radio-class" with the proper selectors.

<script type="text/javascript" charset="utf-8">	
	$(document).ready(function() {
 
		// Identify this question
		var thisQuestion = $('#question{QID}');
 
		// Load first text input
		$('input.my-radio-class').click(function(e) {
			$('input.text:eq(0)', thisQuestion).val($(this).attr('value')); 
		});
 
		// Load second text input
		$('input.another-radio-class').click(function(e) {
			$('input.text:eq(2)', thisQuestion).val($(this).attr('value')); 
		});
    });
</script>

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

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!