Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Mask Character in UK Bank Sort Codes

  • marcgold
  • marcgold's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
4 years 2 months ago #192527 by marcgold
Mask Character in UK Bank Sort Codes was created by marcgold
We have a survey setup to collect bank details as part of the survey.
UK Sort Codes (the code for a specific Bank Branch) are 6 digits long and are 3 sets of 2 digits each.

Often they are written:

Option 1: 00-00-00 (dash separated) or
Option 2: would be laid out as 3 separate fields of 2 numerics each like this [ ] - [ ] - [ ]

The dashes are only for display only and are not needed on the export. In fact it makes it a mess if they are exported.

Does anyone have any bright ideas on how we could achieve this.


Limesurvey Version 3.21
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 2 months ago #192534 by DenisChenu
Replied by DenisChenu on topic Mask Character in UK Bank Sort Codes
Hi,

If i remind you can install plugin ?
gitlab.com/SondagesPro/QuestionSettingsType/jquerySimpleMask

See igorescobar.github.io/jQuery-Mask-Plugin/ for sample

You need to use text question type and for mask : 00-00-00

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.
  • marcgold
  • marcgold's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
4 years 2 months ago #192537 by marcgold
Replied by marcgold on topic Mask Character in UK Bank Sort Codes
Hi Denis,

Thanks for this very useful for others areas, but unfortunately doesn't quite meet this use case.

The problem is that I only want to show the mask on the front end to assist the user. Currently I have the field set to Short Text 6 Chars Long and Numbers Only.

The Mask I have used is 00-00-00

The plugin breaks that logic i'm afraid as it actually adds the "-" into the field meaning its no longer a number. The other issue is when you export this it exports the "-" as well - which really messes with our process.

What I was hoping was a Mask that is for display only.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 2 months ago #192538 by Joffm
Replied by Joffm on topic Mask Character in UK Bank Sort Codes
You may use Expression Manager to remove the dashes afterwards.
manual.limesurvey.org/Expression_Manager...mplemented_functions

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 2 months ago - 4 years 2 months ago #192539 by tpartner
Replied by tpartner on topic Mask Character in UK Bank Sort Codes
You can use RobinHerbots Inputmask plugin with the "removeMaskOnSubmit" option to remove unwanted characters in the data.

Code:
<script src="https://cdnjs.cloudflare.com/ajax/libs/inputmask/4.0.9/jquery.inputmask.bundle.min.js"></script>
<script type="text/javascript" charset="utf-8">
  $(document).on('ready pjax:scriptcomplete',function(){ 
    $('#question{QID} input[type="text"]').inputmask({
      'mask': '99-99-99',
      'placeholder': '_',
      'removeMaskOnSubmit': true,
      'rightAlign': false
    });
  });
</script>

Sample survey attached:

File Attachment:

File Name: limesurvey...5696.lss
File Size:15 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 4 years 2 months ago by tpartner.
The following user(s) said Thank You: DenisChenu, marcgold, Joffm
The topic has been locked.
  • marcgold
  • marcgold's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
4 years 2 months ago #192570 by marcgold
Replied by marcgold on topic Mask Character in UK Bank Sort Codes
Thank you all so much for some excellent ideas. Tpartners solution is the one that best and easily fits the use case.

Denis's solution is the most comprehensive and being a plugin is the easiest to implement across multiple uses.

@DenisChenu - Is there any way to add the function "'removeMaskOnSubmit': true," that is in the JS into the plugin - this would make your plugin just perfect
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 2 months ago - 4 years 2 months ago #192572 by DenisChenu
Replied by DenisChenu on topic Mask Character in UK Bank Sort Codes

marcgold wrote: @DenisChenu - Is there any way to add the function "'removeMaskOnSubmit': true," that is in the JS into the plugin - this would make your plugin just perfect

No, it's not the same plugin.

But can unmask when submit … but still : value is not number … then limesurvey show a JS error.

Maybe the other plugin can return "real' value too when using .val() in JS ?

PS : OK : github.com/RobinHerbots/Inputmask#autounmask is here.

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: 4 years 2 months ago by DenisChenu.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose