Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Show radio button's value next to itself

More
8 years 4 months ago #152993 by McTell
Hi,

I figured out that the answer code from a matrix question is stored as the radio button’s value. I want to achieve to display that value next to the radio button itself... Is that somehow possible?

Thank you,
McTell
The topic has been locked.
More
8 years 4 months ago #152996 by tpartner
LimeSurvey version?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
8 years 4 months ago #153000 by McTell
Version 2.00+ Build 130514
The topic has been locked.
More
8 years 4 months ago #153008 by McTell
For the sake of SEO, the title could also be: How to set text next to a radio button, but in my case I want the text to be the value of the radio button next to it. Thanks for any help
The topic has been locked.
More
8 years 4 months ago #153011 by tpartner
I cannot test on such an old version, but try adding this to the end of template.css:

Code:
.array-flexible-row .answer-item label {
    position: relative;
    float: right;
    left: auto;
    top: auto;
    margin: -2px 3px 0 0;
}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
8 years 4 months ago #153013 by McTell
I actually would prefer a JavaScript solution, since I cannot change the template, and I don’t want to make it permanent. Still playing with some JS ...
The topic has been locked.
More
8 years 4 months ago #153026 by Ben_V
Code:
<script type="text/javascript">
    $(document).ready(function() {
  $("<style type='text/css'>"
  + ".array-flexible-row .answer-item label { position:relative; float:right; left:auto; top:auto; margin:-2px 3px 0 0; }"
  +"</style>").appendTo( "head" );
    });
</script>

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The following user(s) said Thank You: tpartner
The topic has been locked.
More
8 years 4 months ago #153183 by McTell
This is just right aligning the radio button, but it’s not showing the radio button’s value. See the screenshot attached—I want to fetch radio’s value, which corresponds to the answer code, and showing this value next to the radio button (see screenshot on initial post)

Thanks for you help so far,
McTell
The topic has been locked.
More
8 years 4 months ago - 8 years 4 months ago #153184 by Ben_V
Javascript not required for this...

Please just try EM codes like:
Code:
{self.value}

or more sophisticated:
Code:
{if((!is_empty(self.value)&amp;&amp;(self.value > 0)),'+','')}{self.value}

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Last edit: 8 years 4 months ago by Ben_V.
The topic has been locked.
More
8 years 4 months ago - 8 years 4 months ago #153186 by McTell
And where do I put this line of code? Whats EM?

EDIT:
I only get this overview when I click the Expression Manager...
Last edit: 8 years 4 months ago by McTell.
The topic has been locked.
More
8 years 4 months ago - 8 years 4 months ago #153187 by Ben_V
to understand better, juste paste {self.value} in the help area of your radio question...

BTW, you should start to have a look at some key pages of LS documentation like:
www.limesurvey.org/manual/Expression_Manager

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Last edit: 8 years 4 months ago by Ben_V.
The topic has been locked.
More
8 years 4 months ago #153189 by McTell
Nothings happens when I do this...
The topic has been locked.
More
8 years 4 months ago #153192 by Ben_V
OK, maybe the "self" syntax was not implemented in your version (2.00)...

Try using (after replacing "Qcode" by your exact question code):
Code:
{Qcode.value}


I warmly recommend you to update your installation at least with 2.06/2.6 lts version (same interface than 2.00):
github.com/LimeSurvey/LimeSurvey/tree/2.06lts

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The topic has been locked.
More
8 years 4 months ago #153195 by McTell
Unfortunately no values next to radio buttons—this is what I get (see attached). I’ll contact the IT ...
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose