buttons to increase/deacrease numerical input (spinners)

More
1 month 2 weeks ago #177576 by KompetenzZ
KompetenzZ created the topic: buttons to increase/deacrease numerical input (spinners)
Hi,

I found this jquery widget with buttons to increase/decrease the current value: jqueryui.com/spinner/

I tried to integrate this widget in my multiple numerical input subquestions but I don't know how. When I copy the jquery code to the subquestion source of the multiple numeric input question, it creates a new input field (and this new input field does not have the increase/decrease buttons).

Can you give me please a hint how to integrate the increase/decrease buttons in the existing limesurvey input field?

See screenshot:

Cheers kompetenzz
Attachments:

Please Log in or Create an account to join the conversation.

More
1 month 2 weeks ago - 1 month 2 weeks ago #177588 by DenisChenu
DenisChenu replied the topic: buttons to increase/deacrease numerical input (spinners)
If you always use . for numerci separator, best is to create a views/survey/questions/answer/numerical/answer.twig in your theme copy pasted the original one but
replace C.Html.textField by C.Html.numberField

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
Last Edit: 1 month 2 weeks ago by DenisChenu.

Please Log in or Create an account to join the conversation.

More
1 month 2 weeks ago #177663 by KompetenzZ
KompetenzZ replied the topic: buttons to increase/deacrease numerical input (spinners)
Hi,

I took the "answer.twig" file from there:

/home/[servername]/www/application/views/survey/questions/answer/numerical/answer.twig

and then I navigated to:

/home/[servername]/www/upload/themes/survey/[yourTemplateName]/views

and created there the sub folders:

/survey/questions/answer/

and pasted there the file "answer.twig" and changed in the file "C.Html.textField" to "C.Html.numberField".


What else do I have to do for these increase/decrease buttons? It seems that nothing has changed.

Cheers kompetenzz

Please Log in or Create an account to join the conversation.

More
1 month 2 weeks ago #177667 by tpartner
tpartner replied the topic: buttons to increase/deacrease numerical input (spinners)
You should be in /upload/themes/question/, not /survey/.

Have a look at some of the question themes here (or in Denis' repositories) to see the file structure - github.com/tpartner

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in or Create an account to join the conversation.

More
1 month 2 weeks ago - 1 month 2 weeks ago #177669 by DenisChenu
DenisChenu replied the topic: buttons to increase/deacrease numerical input (spinners)

tpartner wrote: You should be in /upload/themes/question/, not /survey/.

Have a look at some of the question themes here (or in Denis' repositories) to see the file structure - github.com/tpartner

No, no,

I talk for : replacing Core twig file ,

see gitlab.com/SondagesPro/SurveyThemes/acce...ons/answer/numerical

Then to ./upload/yoursurveytheme/views/survey/questions/answer/numerical/answer.twig

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
Last Edit: 1 month 2 weeks ago by DenisChenu. Reason: complete dir name

Please Log in or Create an account to join the conversation.

More
1 month 2 weeks ago #177677 by KompetenzZ
KompetenzZ replied the topic: buttons to increase/deacrease numerical input (spinners)
Hi,


I took the "answer.twig" file from the link of your previous post and changed the "C.Html.textField" to "C.Html.numberField".

Then I navigated to:

/home/[servername]/www/upload/themes/survey/[yourTemplateName]/views

and created there the sub folders:

/survey/questions/answer/numerical

and placed the the new "answer.twig" file here.


Is this correct? It seems that nothing has changed. Attached is my theme.

File Attachment:

File Name: extends1_b...2-02.zip
File Size:190 KB

Cheers kompetenzz
Attachments:

Please Log in or Create an account to join the conversation.

More
1 month 2 weeks ago - 1 month 2 weeks ago #177700 by DenisChenu
DenisChenu replied the topic: buttons to increase/deacrease numerical input (spinners)
I don't say to take the one for accessible_vanilla

copy pasted the original one but


But seems ls didn't accept numberfield, is just a little more long

Work on all good browser …

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
Attachments:
Last Edit: 1 month 2 weeks ago by DenisChenu.

Please Log in or Create an account to join the conversation.

More
1 month 2 weeks ago - 1 month 2 weeks ago #177713 by KompetenzZ
KompetenzZ replied the topic: buttons to increase/deacrease numerical input (spinners)
Well, thank you very much for adding the twig files for both questions "numerical input" and "multiple numerical input". That was a great help. As I have several multiple numerical questions, these are handy for persons who are less familiar with the keyboard. However, is there a way to increase the size of these increase/decrease buttons without increasing the size of the whole textbox? Because the buttons represent very small targets.
And I noticed that these buttons do not show on my smartphone (with the current firefox), but that's a minor thing.

Cheers kompetenzz
Last Edit: 1 month 2 weeks ago by KompetenzZ.

Please Log in or Create an account to join the conversation.

More
1 month 2 weeks ago - 1 month 2 weeks ago #177715 by KompetenzZ
KompetenzZ replied the topic: buttons to increase/deacrease numerical input (spinners)
P.S.: Sorry I just want to mention another issue: When the value in the input field does not comply with the max and the min value (which can be set in the input options of the (multiple) numerical question) then the whole inputs of the input fields are made empty again. So, when the answer does not comply with the min/max, the fields are empty again (after clicking "Next"). This is not the case, when I do not insert the twig files. See screenshots.

Screenshot without increase/decrease buttons (normal, tip is red):



Screenshot with increase/decrease buttons (empty and tip is not red)

Cheers kompetenzz
Attachments:
Last Edit: 1 month 2 weeks ago by KompetenzZ.

Please Log in or Create an account to join the conversation.

More
1 month 2 weeks ago - 1 month 2 weeks ago #177728 by DenisChenu
DenisChenu replied the topic: buttons to increase/deacrease numerical input (spinners)
Here, i just move from text input to number input : developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number

Browser must do the job : I think your firefox is outdated here.

But : seems there are an issue about javascript control : this must be rewritten differently … sorry :/

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
Last Edit: 1 month 2 weeks ago by DenisChenu.

Please Log in or Create an account to join the conversation.

More
1 month 2 weeks ago #177729 by DenisChenu
DenisChenu replied the topic: buttons to increase/deacrease numerical input (spinners)
OK,

A fixed template with the script inside custom.js

File Attachment:

File Name: extends1_b...fix2.zip
File Size:191 KB


Remind : it's only usage of developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number

Nothing less, nothing more.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
Attachments:

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago - 1 month 1 week ago #177827 by KompetenzZ
KompetenzZ replied the topic: buttons to increase/deacrease numerical input (spinners)
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:
<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:
<input type="number"  min="0" max="100" placeholder="0"

Cheers kompetenzz
Last Edit: 1 month 1 week ago by KompetenzZ.

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago #177841 by DenisChenu
DenisChenu replied the topic: buttons to increase/deacrease numerical input (spinners)

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:

<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:
<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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in or Create an account to join the conversation.

More
1 week 18 hours ago #179048 by KompetenzZ
KompetenzZ replied the topic: buttons to increase/deacrease numerical input (spinners)
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

Please Log in or Create an account to join the conversation.

More
1 week 14 hours ago - 1 week 14 hours ago #179054 by DenisChenu
DenisChenu replied the topic: buttons to increase/deacrease numerical input (spinners)
??? Can you send me the template + a simple lss file ?

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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
Last Edit: 1 week 14 hours ago by DenisChenu.

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!