- Posts: 348
- Thank you received: 41
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Refer to question code to move "other" option
- Jmantysalo
- Topic Author
- Offline
- Platinum Member
Less
More
4 years 2 weeks ago #196291
by Jmantysalo
Refer to question code to move "other" option was created by Jmantysalo
I was asked for a radiobutton element having "other" as the second last option. For one question I was able to do it by adding script
when I manually look what code the question got. Also I found that {QID} can be used instead of part "1738". But what is the code for all of the "177612X75X1738"-part? I tried {SGQA} and {SGQ} wihtout luck.
Code:
function moveUp($item) { $before = $item.prev(); $item.insertBefore($before); } moveUp($('#javatbd177612X75X1738other'));
when I manually look what code the question got. Also I found that {QID} can be used instead of part "1738". But what is the code for all of the "177612X75X1738"-part? I tried {SGQA} and {SGQ} wihtout luck.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10098
- Thank you received: 3589
4 years 2 weeks ago #196301
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Refer to question code to move "other" option
This works for me in version 3.22.6:
Sample survey attached:
Code:
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ function moveUp($item) { $before = $item.prev(); $item.insertBefore($before); } moveUp($('#javatbd{SGQ}other')); }); </script>
Sample survey attached:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- Jmantysalo
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 348
- Thank you received: 41
4 years 2 weeks ago #196320
by Jmantysalo
Replied by Jmantysalo on topic Refer to question code to move "other" option
Aa-ha! That works also in 4.x. But when I extract the code and put that in the Script-field (below the Help-field), then it does not. So {SGQ} can not be used everywhere. Thanks.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
4 years 2 weeks ago #196327
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Refer to question code to move "other" option
I think it's an issue and must be reported ...Jmantysalo wrote: So {SGQ} can not be used everywhere.
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
4 years 2 weeks ago - 4 years 2 weeks ago #196328
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Refer to question code to move "other" option
Else : you can use
(no space inside sgqa ...) anywhere
manual.limesurvey.org/Expression_Manager#Access_to_Variables
Code:
{QCODE.s gq a}
manual.limesurvey.org/Expression_Manager#Access_to_Variables
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 4 years 2 weeks ago by DenisChenu.
The topic has been locked.
- Jmantysalo
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 348
- Thank you received: 41
4 years 2 weeks ago #196336
by Jmantysalo
Replied by Jmantysalo on topic Refer to question code to move "other" option
I do not undestand. Putting just alert({QID}); to script field of a question gives an alert, but nothing like {QCODE}, {Qcode.sgqa} etc. do not work. Can you make an example survey?
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
4 years 2 weeks ago #196351
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Refer to question code to move "other" option
I try to make a sample survey but don't seems to work for me
16090: No javascript mantis issue
You can try
16090: No javascript mantis issue
You can try
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10098
- Thank you received: 3589
4 years 2 weeks ago - 4 years 2 weeks ago #196355
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Refer to question code to move "other" option
When is that JS loaded?
Maybe it should be wrapped in
or
Maybe it should be wrapped in
Code:
$(document).ready(function() {...});
or
Code:
$(function() { ... });
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 4 years 2 weeks ago by tpartner.
The topic has been locked.
- Jmantysalo
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 348
- Thank you received: 41
4 years 2 weeks ago #196361
by Jmantysalo
Replied by Jmantysalo on topic Refer to question code to move "other" option
There reads "This optional script field will be wrapped, so that the script is correctly executed after the question is on the screen.", so there should be no need to manually write a wrapper.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
4 years 1 week ago #196392
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Refer to question code to move "other" option
+1 for @Jmantysalo
@tpartner : even with wrapper : "i just want to log something" are not in source code
@tpartner : even with wrapper : "i just want to log something" are not in source code
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.