Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

Limit number of choice un multiple drop down list

  • nijan
  • nijan
  • OFFLINE
  • Posts: 108
  • Thanks: 1
  • Karma: 0
11 years 8 months ago #221774 by nijan
And finally ... if I try with more than 1 it fails ...

--> REGEX /\|\*\|{3,}/ (So more then 3 choices).

I really don't understand why it fails ?!

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48459
  • Thanks: 8280
  • Karma: 1443
11 years 8 months ago #221810 by krileon
It counts |*|. You need to subtract 1 based off how many values are selected. Example as follows

2 Values Selected: Val1|*|Val2
3 Values Selected: Val1|*|Val2|*|Val3

So if you want to match 3 values then you need to count 2, not 3.


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 or Create an account to join the conversation.

  • nijan
  • nijan
  • OFFLINE
  • Posts: 108
  • Thanks: 1
  • Karma: 0
11 years 8 months ago #221887 by nijan
Hi Krileon,

I'm sorry to come back again and again with this issue. I think my explainations are not clear (probably my perfect english :whistle: ).

I think that the REGEX doesn't work. To be sure you understand my config, you'll find in attach my Action and my Spoken languages form.




To be sure I edit my profile in backend to have no languages. After that I go to the frontend and I edit my profile. I select for example 5 languagues and I save my profile without any problem. So I think the REGEX has no effect. Is it possible or do I have something wrong ?

Thanks in advance !
Attachments:

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48459
  • Thanks: 8280
  • Karma: 1443
11 years 8 months ago #221928 by krileon
Ok, try the below. Confirmed the REGEX is working so should work fine.

/(.*\|\*\|){2,}/


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 or Create an account to join the conversation.

  • nijan
  • nijan
  • OFFLINE
  • Posts: 108
  • Thanks: 1
  • Karma: 0
11 years 8 months ago #221944 by nijan
No it fails :(
It is very important for me to limit the choice and I'm sure it is possible with REGEX if the output is always VALUE1|*|VALUE2|*| ...

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48459
  • Thanks: 8280
  • Karma: 1443
11 years 8 months ago #221952 by krileon
It doesn't matter what the output is. It's just matching how many times |*| is repeated. The REGEX matches fine in my tests (see attached screenshot). Like I've explained though this isn't really the best way to do this. You really need to implement a custom fieldtype plugin that can handle this properly.

REGEX Match Working:


Note it does not matter what the values are as .* is used to match any character.


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.
Attachments:

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum