- Posts: 30
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
character counter
- mpi0920
- Topic Author
- Offline
- Junior Member
Less
More
3 years 6 months ago #206497
by mpi0920
character counter was created by mpi0920
Hi
I wanted to have a character counter on my text questions and found this code:
{strlen(self.NAOK)}
Can someone tell me how to insert this in a question? Does it belong in the source code of the question and must it be enclosed with <script></script> or similar?
Thanks!
I wanted to have a character counter on my text questions and found this code:
{strlen(self.NAOK)}
Can someone tell me how to insert this in a question? Does it belong in the source code of the question and must it be enclosed with <script></script> or similar?
Thanks!
The topic has been locked.
- mpi0920
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 30
- Thank you received: 0
3 years 6 months ago #206500
by mpi0920
Replied by mpi0920 on topic character counter
I tried this script but I guess I'm still missing something...
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:complete',function({document.write("You use {count(self.NAOK)} character")}))
</script>
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:complete',function({document.write("You use {count(self.NAOK)} character")}))
</script>
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13655
- Thank you received: 2492
3 years 6 months ago #206507
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 character counter
No,
Just put in Questin text (for a short/long … text question)
You answer with {strlen(self.NAOK)}
Nothing to do with javascript, it's included in LimeSurvey (it does js needed function)
You have some example : manual.limesurvey.org/ExpressionScript_e..._a_previous_question
Just put in Questin text (for a short/long … text question)
You answer with {strlen(self.NAOK)}
Nothing to do with javascript, it's included in LimeSurvey (it does js needed function)
You have some example : manual.limesurvey.org/ExpressionScript_e..._a_previous_question
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.
The topic has been locked.
- mpi0920
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 30
- Thank you received: 0
3 years 6 months ago #206516
by mpi0920
Replied by mpi0920 on topic character counter
Hi, thanks. What do you mean with "You answer with {strlen(self.NAOK)}"? Do I have to put this somewhere in the answer options or does it belong in the source code of the question? When I put it in the latter like this it is just displayed as text in the question...
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10110
- Thank you received: 3594
3 years 6 months ago #206523
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 character counter
There are no answer options for short or long text questions.
Place it in the question text as Denis told you.
Place it in the question text as Denis told you.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- mpi0920
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 30
- Thank you received: 0
3 years 6 months ago #206528
by mpi0920
Replied by mpi0920 on topic character counter
Thank you very much! However when I put it inside without any "<script></script> or similar it is just shown as text of the question.. Do you have an idea what I'm doing wrong?
Thank you!
Thank you!
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13655
- Thank you received: 2492
3 years 6 months ago #206538
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 character counter
You must give more information …
demo.sondages.pro/677525
You ask questions since some day now, and never tell your LimeSurvey version … for example
demo.sondages.pro/677525
You ask questions since some day now, and never tell your LimeSurvey version … for example
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.
The topic has been locked.
- mpi0920
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 30
- Thank you received: 0
3 years 6 months ago #206544
by mpi0920
Replied by mpi0920 on topic character counter
Hi the version is Version 3.23.6+ and as in you screenshot the code {strlen(self.NAOK)} is just shown in the text. I don't get how this should count any characters? Thank you again
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13655
- Thank you received: 2492
3 years 6 months ago #206546
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 character counter
Did you try ?mpi0920 wrote: I don't get how this should count any characters?
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.
The topic has been locked.
- mpi0920
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 30
- Thank you received: 0
3 years 6 months ago #206547
by mpi0920
Replied by mpi0920 on topic character counter
Several times.. If I do not have something like <script></script> or <style></style> or whatever it always shows up as text
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13655
- Thank you received: 2492
3 years 6 months ago #206549
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 character counter
DenisChenu wrote:
Did you try ?mpi0920 wrote: I don't get how this should count any characters?
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.
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11668
- Thank you received: 2742
3 years 6 months ago #206588
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic character counter
You need to use the "source" mode. If you just paste it into the WYSIWYG-Editor, then it is displayed as text. On the top left of the editor you see a button "source", click that. It should show all html elements in your question text. If you paste your code in the source mode, it will be interpreted as code, if you put it in the WYSIWYG mode it will be interpreted as normal text.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.