Welcome to the LimeSurvey Community Forum

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

buttons to increase/deacrease numerical input (spinners)

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 3 months ago #177841 by DenisChenu

KompetenzZ wrote: Thank you very much for all the help. Yes, firefox on smartphone works perfectly, I just had to realize that mobile browsers show a special keyboard and no increase/decrease buttons.

The link you provided is very useful.
If someone else ever needs this: After the part:

Code:
<input type="number"

in the twig files some settings can be added, especially a minimum and maximum can be set, so that the spinners cannot operate to undesired number ranges. Also a placeholder "0" at the begin can be displayed:
Code:
<input type="number"  min="0" max="100" placeholder="0"

Yes, but before set this to LimeSurvey we need to remove or fix Expression Manager for usage of ',' in survey :).

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.
  • KompetenzZ
  • KompetenzZ's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
5 years 2 months ago #179048 by KompetenzZ
Hi,

during the pre-test of a survey with these increase/decrease buttons we discovered that the numerical input (the numbers) with increase/decrease buttons vanishes when the respondent clicks on "Next" to getting to the next question page AND then clicks on "Previous" to get to the previous page of the survey. For example if the respondent decide to change his answers from a previous page, the numerical input (the numbers) with increase/decrease buttons are disappeared.

Cheers kompetenzz
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 months ago - 5 years 2 months ago #179054 by DenisChenu
[strike]??? Can you send me the template + a simple lss file ?[/strike]

I take a quick look

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: 5 years 2 months ago by DenisChenu.
The topic has been locked.
  • KompetenzZ
  • KompetenzZ's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
5 years 2 months ago #179092 by KompetenzZ
Maybe my previous post was a bit confusing:
Lets assume we have two question groups (with the general survey setting "Format: Group by group"): G1 is the first question group and G2 is the second question group. When a respondent enters numbers in the concerning numerical input fields in G1 and then he/she clicks on "Next" to get to G2 AND then he/she clicks on "Previous" to get again to G1, the numbers of the concerning numerical input fields in G1 are gone.

Cheers kompetenzz
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 months ago #179102 by DenisChenu
Your survey need to use dot as separator, else : maybe an issue with integer too

See bin.shnoulle.net/?040d7b5c3b3d335c#tEVmb...WDJMyU4Cl3AQlrCDIro=

To replace survey/question/numerical/answer.twig.

The fixed line was
Code:
value="{% if (integeronly == 1 and fValue != "") %}{{ intval(fValue) }}{% else %}{{ fValue }}{% endif %}"
and
Code:
{% if integeronly == 1 %} step=1 {% else %} step="any"{% endif %}

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.
  • KompetenzZ
  • KompetenzZ's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
5 years 2 months ago - 5 years 2 months ago #179133 by KompetenzZ
Thanks, it works great for numeric input questions. But sorry, I didn't say multiple: What do I need to change for multiple numeric input questions?
In the path:
survey\questions\answer\multiplenumeric\rows\input\answer_row.twig

It seems that changing the equivalent lines in the multiple numeric input questions file has no effect. Can this be?

I changed the follwing two lines in answer_row.twig:

Code:
value="{{ fValue }}"
to
Code:
value="{% if (integeronly == 1 and fValue != "") %}{{ intval(fValue) }}{% else %}{{ fValue }}{% endif %}"

and

Code:
{% if integeronly %} step=1 {% endif %}
to
Code:
{% if integeronly == 1 %} step=1 {% else %} step="any"{% endif %}

Cheers kompetenzz
Last edit: 5 years 2 months ago by KompetenzZ.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 months ago #179143 by DenisChenu
in theory : it must work at same way.

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.
  • KompetenzZ
  • KompetenzZ's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
5 years 2 months ago #179148 by KompetenzZ
I have tried it at least three times to change the code in the twig file. Perhaps, could you please try it for multiple numeric questions if it works in your theme? I have no idea here what else could I try.

The text of answer_row.twig that I changed accordingly to your suggestions is saved in this link:
bin.shnoulle.net/?1692f08e38851fb6#IsPLi...hk0ua/UhrZolXu/8h6k=

Cheers kompetenzz
The topic has been locked.
  • KompetenzZ
  • KompetenzZ's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
5 years 2 months ago - 5 years 2 months ago #179150 by KompetenzZ
And if it could help, my theme is attached. This is the theme where I changed the twig files.

File Attachment:

File Name: extends1_b...1-12.zip
File Size:192 KB

Cheers kompetenzz
Last edit: 5 years 2 months ago by KompetenzZ.
The topic has been locked.
  • KompetenzZ
  • KompetenzZ's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
5 years 2 months ago - 5 years 2 months ago #179321 by KompetenzZ
Hi,

sorry for broaching this subject again. I just would need a fix to this issue for my current survey. Changing the two lines in the "answer_row.twig" file did not show any change. It also does not work when I upload and test the concerning theme of my previous post in the hosted limesurvey version.

Here is the code of the twig file in which I changed the two lines (sorry the link of my previous post doesn't work anymore):
Code:
{# /**
 * Multiple short texts question, item input text Html
 * @var $tip
 * @var $alert
 * @var $maxlength
 * @var $tiwidth
 * @var $extraclass
 * @var $sDisplayStyle
 * @var $prefix
 * @var $myfname
 * @var $labelText
 * @var $sufix
 * @var $kpclass
 * @var $rows
 * @var $checkconditionFunction
 * @var $dispVal
 * @var $suffix
 */ #}

<!-- answer_row -->
 
<li id='javatbd{{ myfname }}' class="question-item answer-item numeric-item text-item form-group{{ extraclass }}{% if alert %} ls-error-mandatory has-error {% endif %}" {{ sDisplayStyle }}>
    <!--  color code missing mandatory questions red -->
    <label class="control-label col-xs-12 col-sm-{{ sLabelWidth }}{% if sLabelWidth == 0 %} hidden{% endif %}" for="answer{{myfname}}">
        {{ labelText }}
    </label>
 
    <div class="col-xs-12 col-sm-{{ sInputContainerWidth }}">
        {% if prefix  or  suffix %}
            <div class="ls-input-group">
        {% endif %}
            {% if prefix %}
                <div class="ls-input-group-extra prefix-text prefix">
                    {{ prefix }}
                </div>
            {% endif %}
            <input type="number" min="0" max="10000" placeholder="0"
                value="{% if (integeronly == 1 and fValue != "") %}{{ intval(fValue) }}{% else %}{{ fValue }}{% endif %}"
                name="{{ myfname }}"
                id="answer{{ myfname }}"
                class="form-control"
                title="{{ gT('Only numbers may be entered in this field.') }}"
                {% if size %} size={{ inputsize }} {% endif %}
                {% if maxlength %} maxlength={{ maxlength }} {% endif %}
                {% if integeronly == 1 %} step=1 {% else %} step="any"{% endif %}
            />
            {% if suffix %}
                <div class="ls-input-group-extra suffix-text suffix">
                    {{ suffix }}
                </div>
            {% endif %}
        {% if prefix or suffix %}
            </div>
        {% endif %}
    </div>
</li>
<!-- end of answer_row -->

Cheers kompetenzz
Last edit: 5 years 2 months ago by KompetenzZ.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose