Welcome to the LimeSurvey Community Forum

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

default value in a "Array (Numbers)"-type question

More
7 years 9 months ago #137532 by noyrb
Hi,

Is there a possibility to assign a default value of 0 for all elements in a "Array (Numbers)"-type question?

I'm using LimeSurvey: Version 2.50+ Build 160603.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 9 months ago #137557 by tpartner
Are you using drop-down or text input mode?

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
7 years 9 months ago #137576 by noyrb
I'm using the text input mode
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 9 months ago #137598 by tpartner
Set up your survey to use JavaScript and place this script in the array question source.

Code:
<script type="text/javascript" charset="utf-8">    
  $(document).ready(function() {  
    $('#question{QID} input.text').each(function(i) {
      if($(this).val() == '') {
        $(this).val(0);
        fixnum_checkconditions(this.value, this.name, this.type);
      }
    });  
  });
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: noyrb
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 9 months ago - 7 years 9 months ago #137626 by DenisChenu
Another solution, without javascript.

Add an Equation question type at start of your survey and set the value (if it's empty) for each of you sub question
Code:
{QCODE_SQ001_SQ001=if(is_empty(QCODE_SQ001_SQ001.NAOK),"0",QCODE_SQ001_SQ001.NAOK)}
{QCODE_SQ001_SQ002=if(is_empty(QCODE_SQ001_SQ002.NAOK),"0",QCODE_SQ001_SQ002.NAOK)}
...

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: 7 years 9 months ago by DenisChenu. Reason: ) : sifflote:
The following user(s) said Thank You: holch, tpartner, noyrb
The topic has been locked.
More
7 years 9 months ago - 7 years 9 months ago #137640 by fabcan
Hi Guys I have a question.

So I need an array from 1 to 6 and other 7th option with a write. Can I do that?

E.g.

Not true.............................................................Absolutly True........ .......I dont care
1...................... 2.............. 3............ 4............5............6................................O


Thank you so much
Last edit: 7 years 9 months ago by fabcan.
The topic has been locked.
  • holch
  • holch's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 9 months ago #137647 by holch
This seems to be a totally different question.

And I am not too sure what you are trying to do. What do you mean with "with a write"?

Make a screenshot/image, your ASCII art won't work here in the forum, as the font used is not fixed width.

I assume that you want a scale from 1-6 plus "I don't care", This is quite simple. You can create your custom scale.

For the texts with code 1 and 6 you just put something like this into the box for the answer option.
Code:
Not true<br/>1

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
More
7 years 9 months ago #137650 by fabcan
thank you so much.

But how can I create a new array with likert scale from 1 to 6 plus "O" with label too?

Look at the picture.

Thank you in advance
Attachments:
The topic has been locked.
  • holch
  • holch's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 9 months ago #137652 by holch
That is what I explained to you above. You use the normal array type question and as answer option you will create 1,2,3,4,5,6,0.

When you want text above the number, like for 1, 6 and 0 you adapt the code I gave you. The < br > tag will create a line break.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: DenisChenu
The topic has been locked.
More
7 years 9 months ago #137760 by fabcan
Thank you so much for your answer.

I did that and I fixed in part becasue the program is puting the label only in the first row.

I need to have a number label (1,2,3,4,5,6,0) in each row and not only in the first one. This because I have lot of items and after the 5th one people can't know which answer is linked to the number.

So I need to have for each row the numbers at least.

Thank you in advances
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 9 months ago #137761 by tpartner
Repeating headings in array questions every X subquestions - manual.limesurvey.org/Global_settings#Presentation

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: fabcan
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose