Validation to prevent duplicate selection in dropdown fields.

prevent duplicate selections in multiple dropdown fields.

Overview

The issue occurs when dynamic dropdowns share the same option values, allowing users to select the same value in more than one field.
Use a custom validation function to check the selected values across all dropdowns upon form submission, ensuring each selection is unique.

Answered
ChronoForms v7
cm cmwincom 04 Jul, 2025

I have 4 dropdown fields that are using dynamic options. It is possible that 2 or more of the dropdowns may contain the same values as a selection option. I would like to setup validation so there is no duplication of a value amongst the four fields when the form is submitted.. 

Max_admin Max_admin 09 Jul, 2025
Answer

For this you will need to use Custom Validation function:

https://www.chronoengine.com/faqs/chronoforms/chronoforms8/how-to-use-custom-javascript-or-php-validation-in-your-form

You may get the values of other fields in PHP using 

$this->data("field_name")

and in JavaScript function using 

document.querySelector("[name='field_name']").value
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Post a Reply