### [How to Create a Conditional Rating Form](https://wpforms.com/developers/how-to-create-a-conditional-rating-form/)

**Published:** February 17, 2023
**Author:** Editorial Team

**Excerpt:** This tutorial is going to show you how you can provide a conditional rating form using a little JavaScript and dropdowns. 

**Content:**

Would you be interested in crafting a conditional rating form utilizing dropdown menus? With the [**Survey and Polls** addon](https://wpforms.com/docs/how-to-install-and-use-the-surveys-and-polls-addon/ "Surveys and Polls Addon"), you’re already equipped to generate a form that collects visitor opinions and allows them to vote on various aspects.

However, for our documentation purposes, we aim to design a form enabling users to prioritize features based on numerical values. Given the numerical system for prioritization, it’s essential to prevent duplicate priority numbers for different features chosen by our visitors.

In this tutorial, we’ll construct our rating form using a brief code snippet that eliminates a priority number if it’s already been selected. This ensures we can derive insightful decisions from the priorities our customers express.

## Creating the form

Let’s get started by establishing a new form and integrating the necessary fields. Our form will consist of a **Name** field, an optional **Email** field, and five **Dropdown** fields, each presenting features for rating.

For assistance in setting up your form, feel free to [consult this helpful guide](https://wpforms.com/docs/creating-first-form/ "Creating Your First Form") on creating your initial form.

![begin by creating your form and adding your fields including your dropdown fields](https://wpforms.com/wp-content/uploads/2023/02/conditional-rating-create-form.jpg)

## Setting the Dropdown field options

Now, for our **Dropdown** fields, we’ll need to go through each one and add our rating system. For the purpose of this documentation, our ratings are numerically based on 1-10 meaning 1 is the least favorited option and 10 is the highest.

You can, of course, use what system works best for you whether that’s numerical or text.

![add the options you want your visitors to select when rating your features](https://wpforms.com/wp-content/uploads/2023/02/conditional-rating-add-options.jpg)

## Selecting the Dropdown Style

From the **Advanced** tab of the **Dropdown** field, please remember to select the **Classic** style for your fields. This is very important as the snippet will **only** work with this style.

![from the Advanced tab, select Classic for the style as the snippet will only work with the Classic style](https://wpforms.com/wp-content/uploads/2023/02/conditional-rating-dropdown-style.jpg)

## Creating the conditional rating logic

It’s now time to add the snippet to your site. If you need any assistance with where and how to add snippets to your site, [please check out this tutorial](https://wpforms.com/developers/how-to-add-custom-php-or-javascript-for-wpforms/ "How to Add Custom PHP or JavaScript for WPForms").

```

/**
 * WPForms Conditional Rating Form
 *
 * @link   https://wpforms.com/developers/how-to-create-a-conditional-rating-form/
 */

function wpf_dev_conditional_dropdown_options( ) {
?>

**Categories:** Tutorials

**Tags:** Javascript, JS

---

