Validate a DB value and perform an action

7 years 2 months ago #291452 by osmodels
Hi

I am creating a registration form wherein users have to fill out their info and once they subscribe are assigned a Membership ID.

We are migrating the old users in the CB system, so that they do not have to fill out their data again.

In order to check if old members are in the db or not, we have created an option (radio button field) in the registration form to check if they are new users or existing users. If they are existing users, they need to enter their membership id. If their membership id is already in the DB, we need to inform them that they are already registered and ask them to login. If their id is not in the DB, they need to fill out their details as a new member, asking them to select the "New Member" radio button.

We have created a Text field to allow the user to enter the Membership ID. Using CB Query Fields, Query validation, I check the DB for the [value]. I use Ajax validation.

This works fine when the user presses the tab button after entering the membership id. I get the appropriate success and error messages.

The issue I am facing is that if the user presses the "Enter" key, the form is submitted. If the validation was unsuccessful, the error message gets displayed but if the validation was successful, the success message is not displayed. Instead I get the following message :

Error
Please enter your name.

This is not relevant to the user as the user name field is not yet displayed and in fact my requirement is that the user not proceed with the registration.

Can you tell me how to possibly achieve this requirement?

Reference url: iiaindia.org/registration

Current registered id is 111111 (for testing purposes)
I have attached my CB Query configuration.

Thanks,

Please Log in to join the conversation.

7 years 2 months ago #291460 by krileon
Replied by krileon on topic Validate a DB value and perform an action
Pressing enter in a text input submitting the form is just standard browser behavior. We will not be implementing a means to prevent it. You'd need to add custom jQuery to the page and override the enter key keyup behavior for that input. Ajax validations are not form stopping as due to the nature of ajax they could timeout, etc.. so ajax checks are toggled off immediately on submit as well.

Typically for a usage like yours you'd have a middle-man page. That page would check their ID to determine if existing user or new user. If new user it should send them to registration page. If existing user it should send them to login page. You can probably accomplish this with something like RSForms or any of the other custom form extensions.


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.
The following user(s) said Thank You: osmodels

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.184 seconds

Facebook Twitter LinkedIn