Field Regex Potential

8 years 7 months ago #271492 by edmundcheong
Field Regex Potential was created by edmundcheong
For fields we are able have a regular expression to control the format of the data.

By any chance is there a way to preview the format of the regular expression in the field itself?

Is there a way if we put in a regular expressions (/d{1}-d{1}/ for example), the user would just enter the digits and the "-" auto populates after the first digit?

Another example to clear my question, we know that visa numbers are 0000-0000-0000-0000. Is there a way for the uaer to enter the digits only and the cb field populates the "-" by degault?

Please Log in to join the conversation.

8 years 7 months ago #271534 by krileon
Replied by krileon on topic Field Regex Potential
We have no inputmask feature. The regex is just the validation and not an inputmask, which is what enforces the format you're wanting during typing. You'd have to use CB Auto Actions and a Code action to insert jQuery to force an inputmask on your field to do that.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

8 years 7 months ago #271546 by edmundcheong
Replied by edmundcheong on topic Field Regex Potential
By any chance, are you able to provide an example? I am assuming, the code should trigger beforeprofileeditdisplay? Or after?

Please Log in to join the conversation.

8 years 7 months ago #271582 by krileon
Replied by krileon on topic Field Regex Potential
I would use the onAfterRegisterFormDisplay and onAfterUserProfileEditDisplay triggers to insert your jQuery. CB comes with an inputmask jQuery plugin. You should be able to utilize it for example as follows.

Method: jQuery
Code:
$( '#FIELD_NAME' ).inputmask( '9999-9999-9999-9999' );
Plugins: inputmask

The jQuery plugin CB currently has for inputmask is as follows.

github.com/RobinHerbots/jquery.inputmask


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

8 years 7 months ago #271628 by edmundcheong
Replied by edmundcheong on topic Field Regex Potential
if i understand it correctly, I should crete the following auto action:

Published: Yes
Title: test input mask
Type: Code
Triggers: onAfterUserProfileEditDisplay
User: Automatic
Access: Everybody
Conditional: [name] NOT EMPTY
Method: jQuery
Code: $( '#cb_fieldnametest' ).inputmask( '9999-9999-9999-9999' );
Plugin URLs: robinherbots.github.io/jquery.inputmask
Plugins: inputmask

Somehow the field is still the same.. anything that I am missing out? as for the fieldname in the code, should it be the column name in the table?

Please Log in to join the conversation.

8 years 7 months ago #271636 by krileon
Replied by krileon on topic Field Regex Potential
You don't need to specify Plugin URLs. Just the Plugins parameter as that jQuery plugin is included with CB. I'm not sure I understand the condition though. Name should never be empty. You also need to include the onAfterRegisterFormDisplay trigger if you want it to work on registration in addition to profile edit.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.212 seconds

Facebook Twitter LinkedIn