Letters counter

Plus d'informations
il y a 4 ans 2 mois #125885 par helviobrito
Letters counter a été créé par helviobrito
Hi. I'd like to include a counter in text fields of limited sizes. For example: in a text question for 300 characters, a counter starts in 300 and, as respondent write, the counter shows number of characters are left till the end. Can anyone provide a solution?

Connexion ou Créer un compte pour participer à la conversation.

LimeSurvey Partners
Plus d'informations
il y a 4 ans 2 mois #125887 par holch
Réponse de holch sur le sujet Letters counter
This is more a general web development question (javascript) rather than a Limesurvey question:

www.sitepoint.com/10-jquery-wordtext-counter-plugins/

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 4 ans 2 mois - il y a 4 ans 2 mois #125888 par Ben_V
Réponse de Ben_V sur le sujet Letters counter
For a text question with question code "qtext" (200 chars. max.):

try to place in the help area of this question
count: {strlen(self)}
left: {sum(200 - strlen(self))}

for other place try:
count: {strlen(qtext)}
left: {sum(200 - strlen(qtext))}

BTW, all EM functions are listed here :)

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Dernière édition: il y a 4 ans 2 mois par Ben_V.
Les utilisateur(s) suivant ont remercié: DenisChenu, holch, first

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 4 ans 2 mois #125896 par holch
Réponse de holch sur le sujet Letters counter
Hey Ben, thank you. This works great (only tried it with the "self" version).

@Helviobritto: No need to go for a plugin. LS has this onboard solution which works great and in real time.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 4 ans 2 mois #125907 par Ben_V
Réponse de Ben_V sur le sujet Letters counter
I suppose there is some way to change the number color when you are near or pass the limit, something like green -> orange -> red ...

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 5 mois 1 semaine #185521 par Mazi
Réponse de Mazi sur le sujet Letters counter
Using the integrated Limesurvey Expression Manager functions is indeed the best approach. We have documented the full approach at this blog post: " How to count the number of characters entered at a Limesurvey text question ". It also shows how to limit the number of characters and how to reference the character count at other questions.

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com
Want to use your survey offline -> www.offlinesurveys.com

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 5 mois 1 semaine #185540 par holch
Réponse de holch sur le sujet Letters counter
@Mazi: Saw your post and tried your sample survey. Looks good. But I was able to send a text with 165 characters (according to your count). What happened?

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 5 mois 1 semaine #185546 par Mazi
Réponse de Mazi sur le sujet Letters counter
I also noticed that when entering some dummy characters. It tuend out that character like "<" had not been counted. Could it have been a similar case? If you just enter the same character 160 times it works fine.

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com
Want to use your survey offline -> www.offlinesurveys.com

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 5 mois 1 semaine #185547 par holch
Réponse de holch sur le sujet Letters counter
I did not use any special characters, if I recall right (just have a look at the last result in your Demo and you'll see my text). ;-)

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 5 mois 1 semaine #185548 par holch
Réponse de holch sur le sujet Letters counter
Here another test. I inserted this text until the text field wouldn't allow any further text.

This is a text with more than 160 characters. Let's see if it works now as expected. It should not be possible to insert more than 160 characters, but last time


Here what your Demo shows me:


I copied and pasted the text into Word and it counted only 160 characters, just like Limesurvey did, but your function counted 165 characters...

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds
Pièces jointes :

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 5 mois 1 semaine #185549 par holch
Réponse de holch sur le sujet Letters counter
I think I found the vilain. It is the ' (apostrophe).

When you insert "Let" it counts 3 characters, just as it should. If you add the apostrophe and have something like "Let'" it jumps to 9, so the apostrophe counts as 6 characters. Let's is 10 characters.

So this would explain that your count counts 165 characters, when Limesurvey stops at 160 characters. So the error is in the function "strlen" somewhere I guess?

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 5 mois 1 semaine #185551 par Mazi
Réponse de Mazi sur le sujet Letters counter
Yes, I think so, but it is not really a bug: "strlen() returns the number of bytes rather than the number of characters in a string."
-> www.php.net/manual/en/function.strlen.php

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com
Want to use your survey offline -> www.offlinesurveys.com

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 5 mois 1 semaine #185552 par holch
Réponse de holch sur le sujet Letters counter
Well, then it is not a bug in strlen, but then it is a bug in your approach. ;-)

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 5 mois 1 semaine #185572 par DenisChenu
Réponse de DenisChenu sur le sujet Letters counter
If we use www.php.net/manual/fr/function.mb-strlen.php in PHP, need a mb_strlen in javascript …
Or maybe our JS have an issue

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 .
An error happen ? Before make a new topic : remind the Debug mode .

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 5 mois 1 semaine #185580 par Mazi
Réponse de Mazi sur le sujet Letters counter

holch écrit: I did not use any special characters, if I recall right (just have a look at the last result in your Demo and you'll see my text). ;-)


k, then let's call it a Limesurvey bug :-)

We have added a note about the special characters so users won't be confused.

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com
Want to use your survey offline -> www.offlinesurveys.com

Connexion ou Créer un compte pour participer à la conversation.

Commencez dès maintenant !

Créez simplement un compte et commencez à utiliser LimeSurvey dès aujourd'hui.

Inscrivez-vous maintenant

Inscrivez-vous à notre Newsletter!