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

  • McTell
  • McTell's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 10 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.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 10 months ago #152996 by tpartner
Replied by tpartner on topic Show radio button's value next to itself
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.
  • McTell
  • McTell's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 10 months ago #153000 by McTell
Replied by McTell on topic Show radio button's value next to itself
Version 2.00+ Build 130514
The topic has been locked.
  • McTell
  • McTell's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 10 months ago #153008 by McTell
Replied by McTell on topic Show radio button's value next to itself
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.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 10 months ago #153011 by tpartner
Replied by tpartner on topic Show radio button's value next to itself
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.
  • McTell
  • McTell's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 10 months ago #153013 by McTell
Replied by McTell on topic Show radio button's value next to itself
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
6 years 10 months ago #153026 by Ben_V
Replied by Ben_V on topic Show radio button's value next to itself
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.
  • McTell
  • McTell's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 10 months ago #153183 by McTell
Replied by McTell on topic Show radio button's value next to itself
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
6 years 10 months ago - 6 years 10 months ago #153184 by Ben_V
Replied by Ben_V on topic Show radio button's value next to itself
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: 6 years 10 months ago by Ben_V.
The topic has been locked.
  • McTell
  • McTell's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 10 months ago - 6 years 10 months ago #153186 by McTell
Replied by McTell on topic Show radio button's value next to itself
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: 6 years 10 months ago by McTell.
The topic has been locked.
More
6 years 10 months ago - 6 years 10 months ago #153187 by Ben_V
Replied by Ben_V on topic Show radio button's value next to itself
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:
manual.limesurvey.org/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: 6 years 10 months ago by Ben_V.
The topic has been locked.
  • McTell
  • McTell's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 10 months ago #153189 by McTell
Replied by McTell on topic Show radio button's value next to itself
Nothings happens when I do this...
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose