Skip to Content Skip to Menu

How to add a Query Drop Down (Single Select) field to the form validation work flow?

  • carin
  • carin
  • OFFLINE
  • Posts: 417
  • Thanks: 18
  • Karma: 0
10 years 3 months ago #247412 by carin
I have a Query Drop Down (Single Select) field that picks up some values from the db. How do I add validation to that field on registration and edit?

CB 2.0

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48479
  • Thanks: 8282
  • Karma: 1443
10 years 3 months ago #247420 by krileon
There's nothing to validate. The values are not user input and are coming from a query that you've constructed. So it's not possible or necessary to add validation. If you want them to be uniquely selected you can adjust the database query to JOIN _comprofiler and make sure a value hasn't been selected.


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.

  • carin
  • carin
  • OFFLINE
  • Posts: 417
  • Thanks: 18
  • Karma: 0
10 years 3 months ago #247428 by carin
"it's not possible"
... ok, when will it be?

" or necessary to add validation"
... it is necessary : when the field is requiered and the user did not choose an option, so I need validation to validate the current option is not "-"

CB 2.0

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48479
  • Thanks: 8282
  • Karma: 1443
10 years 3 months ago #247469 by krileon

... ok, when will it be?

Never, there is nothing to validate.

... it is necessary : when the field is requiered and the user did not choose an option, so I need validation to validate the current option is not "-"

Set the field as required. It handles required same as any other field. The value "-" is valid, it needs to be an empty string. It uses the same API as a normal select field except it passes the options array from the result of your query instead of from the field values database table. CB automatically adds the blank value to a select field so you shouldn't need to add one.


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.

  • carin
  • carin
  • OFFLINE
  • Posts: 417
  • Thanks: 18
  • Karma: 0
10 years 3 months ago #247476 by carin

CB automatically adds the blank value

... not in my CB, first option is a value from the db, not a blank. What could be missing here?

CB 2.0

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48479
  • Thanks: 8282
  • Karma: 1443
10 years 3 months ago #247483 by krileon

... not in my CB, first option is a value from the db, not a blank. What could be missing here?

Please see the below of it working fine. If it's non-required there will always be a blank. If it's required and there isn't a value (e.g. registration) then there will be a blank. If it's required and there is a value (e.g. profile edit) then there will not be a blank.

Non-Required:



Required:


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