- Posts: 19
- Thank you received: 1
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Text masket input
- csknfrt
- Topic Author
- Offline
- New Member
Less
More
6 years 2 months ago - 6 years 2 months ago #163874
by csknfrt
Text masket input was created by csknfrt
Hello,
I use text input mask on the LS 2.73 but I couldn't use since LS 3.0.
is there any way to make it like picture?
I use text input mask on the LS 2.73 but I couldn't use since LS 3.0.
is there any way to make it like picture?
Attachments:
Last edit: 6 years 2 months ago by csknfrt.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
6 years 2 months ago #163889
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 Text masket input
Can you explain more about what you have done and whether you get any JavaScript errors in the console?
Can you attach a small test survey containing only that question?
Can you attach a small test survey containing only that question?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- csknfrt
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 1
6 years 2 months ago #164405
by csknfrt
Replied by csknfrt on topic Text masket input
I applied steps below on the LS 2.73 and succeeded. But there isn't startpage.pstpl on the LS 3.x.x so i couldn't do it. How can I do masked input on the LS 3.x.x below?
I want to make the parcicipants to write their phone numbers as 555-555-5555
Survey Example
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function($) { $("#answer55431X1X5").mask("999-99-9999",{ placeholder:"#" }); }); </script>
I want to make the parcicipants to write their phone numbers as 555-555-5555
Survey Example
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
6 years 2 months ago - 6 years 2 months ago #164412
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 Text masket input
I think you needed to do more than that to make it work in 2.7x. You must have also included the masking function in the template somewhere.
In 3.x, I would think you need to:
1) Extend an existing theme
2) Upload the masking function file to /upload/themes/survey/yourNewThemeName/scripts/
3) Include it in /upload/themes/survey/yourNewThemeName/config.xml like this:
4) Insert something like this in the source of the question text:
More about the new template system in LS3.x here - manual.limesurvey.org/New_Template_System_in_LS3.x
In 3.x, I would think you need to:
1) Extend an existing theme
2) Upload the masking function file to /upload/themes/survey/yourNewThemeName/scripts/
3) Include it in /upload/themes/survey/yourNewThemeName/config.xml like this:
Code:
<files> <css> <add>css/ajaxify.css</add> <add>css/theme.css</add> <add>css/custom.css</add> </css> <js> <add>scripts/theme.js</add> <add>scripts/ajaxify.js</add> <add>scripts/myMaskingScript.js</add> </js> <print_css> <add>css/print_theme.css</add> </print_css> </files>
4) Insert something like this in the source of the question text:
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function($) { $('#question{QID} input[type="text"]').mask("999-99-9999",{ placeholder:"#" }); }); </script>
More about the new template system in LS3.x here - manual.limesurvey.org/New_Template_System_in_LS3.x
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 6 years 2 months ago by tpartner.
The topic has been locked.
- csknfrt
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 1
6 years 2 months ago - 6 years 2 months ago #164428
by csknfrt
Replied by csknfrt on topic Text masket input
I tried what you wrote, but unfortunately it didn't work.
Step 1 - Done
Upload the masking function file to /upload/themes/survey/Ana_Tema_fruity/scripts/jquery.maskedinput.js
Step 2 - Done
Include it in /upload/themes/survey/Ana_Tema_fruity/config.xml
Step 3 - Done
Insert something like this in the source of the question text:
Step 1 - Done
Upload the masking function file to /upload/themes/survey/Ana_Tema_fruity/scripts/jquery.maskedinput.js
Step 2 - Done
Include it in /upload/themes/survey/Ana_Tema_fruity/config.xml
Code:
<files> <css> <add>css/ajaxify.css</add> <add>css/theme.css</add> <add>css/custom.css</add> </css> <js> <add>scripts/theme.js</add> <add>scripts/ajaxify.js</add> <add>scripts/jquery.maskedinput.js</add> </js> <print_css> <add>css/print_theme.css</add> </print_css> </files>
Step 3 - Done
Insert something like this in the source of the question text:
Code:
Lütfen cep telefon numaranızı yazınız <script type="text/javascript" charset="utf-8"> $(document).ready(function($) { $("#answer784213X3X41").mask("(0999) 999 99 99",{ placeholder:"" }); }); </script>
Attachments:
Last edit: 6 years 2 months ago by csknfrt.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
6 years 2 months ago #164431
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 Text masket input
jquery.maskedinput.js is not being included. Try uninstalling and re-installing the theme so the changes in config.xml are loaded.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.