Skip to Content Skip to Menu

How to validate several fields of a registration form

  • cppleal
  • cppleal
  • OFFLINE
  • Posts: 76
  • Thanks: 10
  • Karma: 1
6 months 1 day ago #338139 by cppleal
Good morning.
I want to do a combined validation between two or more fields, which already exist in a Registration form. How can I do it?
It does not have to be at the moment, it could be done at the end of the member's registration.

Thanks

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48536
  • Thanks: 8290
  • Karma: 1445
6 months 1 day ago #338141 by krileon
Combined validation? Can you be more specific about what you're wanting to do? You want to combine the values of 2 fields then validate 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 or Create an account to join the conversation.

  • cppleal
  • cppleal
  • OFFLINE
  • Posts: 76
  • Thanks: 10
  • Karma: 1
6 months 1 day ago #338142 by cppleal
OK, Krileon.
I have two fields of guarantor Membership number on the registration screen.
Field 1: Guarantor Member Number 1. Validates that the member exists and is over 18 years old (with CB Query Field).
Field 2: Guarantor Member Number 2. Validates that the member exists and is over 18 years old (with CB Query Field).
Now, what I need is to validate that the guarantor specified in Field 1 and Field 2 live at different addresses. 

How can I do?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48536
  • Thanks: 8290
  • Karma: 1445
6 months 1 day ago #338143 by krileon
You should be able to do that with CB Code Field and its Code Validation. You'd then just use PHP and compare the two fields values. Which field you add this validation to is up to you (could also just add it to both). Example as follows.
Code:
return ( '[cb_field1]' !== $value );

If these fields aren't marked required be sure you take into account them being empty. This will also work with ajax validation for client side validation if you adjust the Additional Fields to include the other address field.


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.

Moderators: beatnantkrileon
Powered by Kunena Forum