Check out the LimeSurvey source code on GitHub!

Enable disable answer option

3 years 2 months ago #102762 by darpao
How can I disable radio button based on a previous question answer?

For example:

A - Insert a number (1 or 2)

B - Choice one
10 -> enabled if 1 or 2 at A
11 -> enabled if 1 at A
12 -> enabled if 2 at A
13 -> enabled if 1 or 2 at A

Please Log in to join the conversation.

3 years 2 months ago #102776 by tpartner
There is no built-in capability to apply conditions or relevance to answers, however, you could create two versions of question "B" and use conditions or relevance to show the appropriate version.

Another approach would be to use JavaScript to filter the answers in question "B" but this would only really work if both questions are on the same page.

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.

3 years 2 months ago #102799 by darpao
I would like to use Javascript, but I'm not able to find a sample script easy to change..

The first one is not possible because the options are not 2 but more.. so I should use too many versions of second question..

I'm surprised there isn't something like this!!

Anyway, thank you.. I will investigate more..

Actually I use this script, but is not easy to use..
Every time I have to change everything if I copy the survey from a server to another.. but I cannot understand all this calls to questions in LimeSurvey..

For example.
This works for radio button, but for checkbox?!?

Why sometime #question355 is good and other times I need to use #answer364448X11X3551 ?!?

Where I can find all methods that I can apply to a question and its documentation? Like

$("#question354 input").change(function() { ........... });
$("#question355 input").each(function() { ........... });

Or a list of attributes like:
$("#question355 input:radio").attr("checked", false);

<script type="text/javascript" charset="utf-8">
function checkGeo() {
var D9 = $("#question354 input:checked").val();
var D10 = [ "#answer364448X11X3551","#answer364448X11X3552","#answer364448X11X3553",
"#answer364448X11X3556","#answer364448X11X3557","#answer364448X11X3558" ];

if (D9 == "9" || D9 == "10") {
for (var i=0; i<=5; i++) {


var answer = $("#answer364448X11X3557");;
answer.attr("checked", true);


else if (D9 != "7" && D9 != "8" && D9 != "11" && D9 != "5") {

$(document).ready(function() {
$("#question354 input").change(function() {
// nel caso in cui cambiando la risposta precedente deve essere disabilitato un input giĆ  selezionato
$("#question355 input:radio").attr("checked", false);
$("#question355 input").each(function() {


Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form