- Posts: 153
- Thank you received: 8
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
buttons to increase/deacrease numerical input (spinners)
- KompetenzZ
- Topic Author
- Offline
- Premium Member
Less
More
5 years 4 months ago #177576
by KompetenzZ
Cheers kompetenzz
buttons to increase/deacrease numerical input (spinners) was created by KompetenzZ
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:
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:
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13624
- Thank you received: 2490
5 years 4 months ago - 5 years 4 months ago #177588
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 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
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 , plugin development .
I don't answer to private message.
Last edit: 5 years 4 months ago by DenisChenu.
The topic has been locked.
- KompetenzZ
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 153
- Thank you received: 8
5 years 4 months ago #177663
by KompetenzZ
Cheers kompetenzz
Replied by KompetenzZ on 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.
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
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10103
- Thank you received: 3591
5 years 4 months ago #177667
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 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
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.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13624
- Thank you received: 2490
5 years 4 months ago - 5 years 4 months ago #177669
by DenisChenu
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 , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic buttons to increase/deacrease numerical input (spinners)
No, no,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
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 , plugin development .
I don't answer to private message.
Last edit: 5 years 4 months ago by DenisChenu. Reason: complete dir name
The topic has been locked.
- KompetenzZ
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 153
- Thank you received: 8
5 years 4 months ago #177677
by KompetenzZ
Cheers kompetenzz
Replied by KompetenzZ on 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.
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.
Cheers kompetenzz
Attachments:
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13624
- Thank you received: 2490
5 years 4 months ago - 5 years 4 months ago #177700
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 buttons to increase/deacrease numerical input (spinners)
I don't say to take the one for accessible_vanilla
But seems ls didn't accept numberfield, is just a little more long
Work on all good browser …
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 , plugin development .
I don't answer to private message.
Attachments:
Last edit: 5 years 4 months ago by DenisChenu.
The topic has been locked.
- KompetenzZ
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 153
- Thank you received: 8
5 years 4 months ago - 5 years 4 months ago #177713
by KompetenzZ
Cheers kompetenzz
Replied by KompetenzZ on 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.
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: 5 years 4 months ago by KompetenzZ.
The topic has been locked.
- KompetenzZ
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 153
- Thank you received: 8
5 years 4 months ago - 5 years 4 months ago #177715
by KompetenzZ
Cheers kompetenzz
Replied by KompetenzZ on 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)
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: 5 years 4 months ago by KompetenzZ.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13624
- Thank you received: 2490
5 years 4 months ago - 5 years 4 months ago #177728
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 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
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 , plugin development .
I don't answer to private message.
Last edit: 5 years 4 months ago by DenisChenu.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13624
- Thank you received: 2490
5 years 4 months ago #177729
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 buttons to increase/deacrease numerical input (spinners)
OK,
A fixed template with the script inside custom.js
Remind : it's only usage of developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number
Nothing less, nothing more.
A fixed template with the script inside custom.js
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 , plugin development .
I don't answer to private message.
Attachments:
The topic has been locked.
- KompetenzZ
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 153
- Thank you received: 8
5 years 4 months ago - 5 years 4 months ago #177827
by KompetenzZ
Cheers kompetenzz
Replied by KompetenzZ on 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:
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:
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:
Cheers kompetenzz
Last edit: 5 years 4 months ago by KompetenzZ.
The topic has been locked.