I'm trying to create a question (default template) in which the user can either type in text into a (free standing) text box or enable a radiobutton. The both input types shall appear one below the other and must be exclusive, so that if there is text in the box, the radiobutton gets deactivated.
Unfortunately I could not accomplish this so far and would be very grateful for any help.
You can freely choose the text that is given to the other option. You might have to put at least a space, because otherwise it probably will use the default option.
I don't think that you can move the "other" option up in LS. But probably you can do something with Javascript. But I have no clue about that.
Help us to help you!
Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.
2) Add the following script to the source of the question. The script will hide The "Other" radio and label and move the text input to the top of the list.
Code:
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
// Identify this question
var q1ID = '{QID}';
var q1 = $('#question'+q1ID+'');
// Hide the "Other" radio button and label
$('.other-item input.radio, .other-item .answertext', q1).hide();
// Move the "Other" row to the top
$('.radio-list', q1).prepend($('.other-item', q1));
});
</script>
Cheers,
Tony Partner Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Is it also possible to move the text input to a specific position, say at position 3?
I think in this case the "prepend" in the following lines has to be changed.
Code:
// Move the "Other" row to the top
$('.radio-list', q1).prepend($('.other-item', q1));
});
Unfortunately, I don't know how it has to be changed. Can someone help?
Thank you, that's what I need .
Another question: Is it also possible to change the code of the "other" option such that, if it is chosen, there will be an 8 in my SPSS dataset?