Welcome, Guest
Username: Password: Remember me

TOPIC: Display commas in long numeric inputs

Display commas in long numeric inputs 2 years 10 months ago #67709

  • Fred
  • Fred's Avatar
  • OFFLINE
  • Gold Lime
  • Posts: 163
  • Thank you received: 5
  • Karma: 3
We ask a lot of numeric questions where the answer will be in the millions. When a respondent enters this in a numeric field, it looks like this: 200000000. It's hard at a glance to tell if that's 20m or 200m, resulting in input errors. Is there a way to make these entries display with comma separators, like this: 200,000,000 ?
The administrator has disabled public write access.

Re: Display commas in long numeric inputs 2 years 10 months ago #67724

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6256
  • Thank you received: 799
  • Karma: 239
Hello,

For this problem, i use extra jquery script with text question.

Jquery masked input for example

ANd see:
Workarounds: Manipulating a survey at runtime using Javascript

Denis
The administrator has disabled public write access.

Re: Display commas in long numeric inputs 2 years 9 months ago #67758

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5324
  • Thank you received: 293
  • Karma: 248
I think there is a nice jQuery plugin for this, see docs.limesurvey.org/Workarounds%3A+Manip...vey#Text_input_masks

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.

Re: Display commas in long numeric inputs 2 years 9 months ago #67827

  • Fred
  • Fred's Avatar
  • OFFLINE
  • Gold Lime
  • Posts: 163
  • Thank you received: 5
  • Karma: 3
Shnoulle and Mazi, thank you!! Now I see that in the workarounds section. I will try the 2JavaScript options and see which one I can get to work.
The administrator has disabled public write access.

Re: Display commas in long numeric inputs 2 years 9 months ago #67867

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5324
  • Thank you received: 293
  • Karma: 248
You're welcome!

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.

Re: Display commas in long numeric inputs 2 years 9 months ago #68450

  • Fred
  • Fred's Avatar
  • OFFLINE
  • Gold Lime
  • Posts: 163
  • Thank you received: 5
  • Karma: 3
Hi, reporting back on my test.

1) The Digital Bush Masked Input scripts don't support this application. It's designed for fixed input masks. So you could have a mask "999,999" and it would work correctly if the user input was 100000 (100,000). But if the user entered 10000, it would display as "100,00." I checked this with Josh Bush and he agreed.

2) The Meio mask scripts has a "reverse" parameter that seems to solve the problem. This mask works for all numbers up to 9 billion+.
customMaskThousands:{mask: '999,999,999,9', type : 'reverse', defaultValue : '000'}

However, I saw some warnings in the Workarounds page that the Meio scripts aren't supported anymore? Is it just because of an IE6 problem? (in which case I don't care). Does the suggestion of copying the whole script into the help text work?
docs.limesurvey.org/Workarounds%3A+Manip...vey#Text_input_masks
The administrator has disabled public write access.

Re: Display commas in long numeric inputs 2 years 9 months ago #68451

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4119
  • Thank you received: 760
  • Karma: 346
I believe that "Meio scripts aren't supported anymore" just means that there is no more development or support so they may not work with future JavaScript libraries. I use the mask plugin extensively and have not had a problem.
Cheers,
Tony Partner

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

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: Display commas in long numeric inputs 2 years 9 months ago #68467

  • Fred
  • Fred's Avatar
  • OFFLINE
  • Gold Lime
  • Posts: 163
  • Thank you received: 5
  • Karma: 3
Ok, thank you.

One thing I have realized is that the Meio scripts work great for displaying the numbers with comma separators, but when the data is saved to the database, it's not correct.

For example...
user enters: 10000000
masked input displays: 10,000,000
database stores: 10

In this case I have the mask on a numeric question type. Presumably I could make it work by using a text question type, but this will create problems in the tabulation and analysis.

I just want it to display nicely in the form, but lose the commas when it saves to the database.
The administrator has disabled public write access.

Re: Display commas in long numeric inputs 2 years 9 months ago #68469

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4119
  • Thank you received: 760
  • Karma: 346
What have you set as the decimal separator?

Survey properties --> Edit text elements
Cheers,
Tony Partner

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

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: Display commas in long numeric inputs 2 years 9 months ago #68470

  • Fred
  • Fred's Avatar
  • OFFLINE
  • Gold Lime
  • Posts: 163
  • Thank you received: 5
  • Karma: 3
Hi, I have "Dot(.)" as the decimal separator. I assume this means the real decimal separator (e.g., 3.1415) as opposed to the comma separator for thousands. We are thinking in U.S. style where the decimal separator is "." and thousands are separated by ","
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.132 seconds
Donation Image