Radio Button Cases and Unique email address

Send different emails and validate unique addresses in a ChronoForms radio button form.

Overview

The issue occurs because the same email action runs for all radio button selections, and there is no built-in check for duplicate email submissions.
Use an Event Switcher action in the On Submit event to direct each radio button choice to a separate event with its own email content. Add custom JavaScript for conditional field validation and to check email uniqueness before submission.

Answered
ru ruchika 26 Feb, 2016
Hi,

I am creating a form using chronoform component and wants to have certain functionalities.

1) An email id has to be unique - once user has submitted the form with an email id cannot submit it again
2) I have 3 radio buttons : radio1 , radio2, radio3

On submission of form, I want to save the form in database and achieve different functionalities as below:
1) When user selects radio1 = a specific message must be sent along with the form details
2) When user selects radio2 = another mail must be sent with form details. Also fields like address and city must become required.
3) When user selects radio3 = email with form details must be sent and user must be redirected to paypal page

For now, I am calling DB save, email and display message methods in On submit event. But every time same email is being sent to the user.

Please guide me through this that how can I send different emails+ form details to the user and also to validate unique email id.

Thanks in advance for any help
Gr GreyHead 26 Feb, 2016
Answer
1 Likes
Hi ruchika,

You can use custom JavaScript to check the email uniqueness with an Ajax call and/or you can check with Custom Code after submission using an Event Switcher action to reload the form with a message if there is a duplication.

You can also use the Event Switcher to handle the different On Submit options. I'd probably set two events to handle cases 1 & 2 and put case 3 after the Event Switcher.

The most difficult is to handle the conditional validation in case 2 as the ChronoForms validations are set up when the page loads. Probably the best way to do this is to write a custom validation function for the address and city elements that will check if button 2 is selected.

There are FAQs with more details of most of these.

Bob
ru ruchika 29 Feb, 2016
Hi,

Thank you for your response and it helped me to solve my problem. Following is the step which I used:

1) For making required fields when radio 2 is selected, I added load javascript method in On load event. Here, I added my own custom js functions which I called them in those fields which has to be made required.
2) For different email and messages, as you recommended I created Event Switcher in On submit event. And added different events by dragging them inside the switcher and adding my own content.
3) For unique email address, again added a function in that field and used custom js.

Thank you once again for your help and response.
This topic is locked and no more replies can be posted.