Welcome to the LimeSurvey Community Forum

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

buttons to increase/deacrease numerical input (spinners)

More
6 years 7 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.
More
6 years 7 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 support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
More
6 years 7 months ago - 6 years 7 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: 6 years 7 months ago by KompetenzZ.
The topic has been locked.
More
6 years 7 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 support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
More
6 years 7 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.
More
6 years 7 months ago - 6 years 7 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:191.78 KB

Cheers kompetenzz
Last edit: 6 years 7 months ago by KompetenzZ.
The topic has been locked.
More
6 years 7 months ago - 6 years 7 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: 6 years 7 months ago by KompetenzZ.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose