In the modern world, integral is used in every aspect. Ninja Form is a powerful WordPress plugin that provides this solution. You can effortlessly create the form. First, you need to create a form according to your desire. First, install the Ninja Forms plugin from wordpress.org. Here you can learn to create forms with the Ninja Forms Plugin.

Two types of fields can used to base a calculation.

  1. Fields that can accept the numeric input
  2. Fields with a ‘Calc Value’ attribute.

1. Numeric Input

Number

The number field accepts numeric input only. Here you can set the minimum and maximum number that will be acceptable in this input field.

2. Calc Value

Some following fields have Calc Value setting and can be used in calculations:

  1. Single Checkbox: Checkbox for selecting a single option.
  2. Checkbox List: List of checkboxes for selecting multiple options.
  3. Select List: Dropdown menu for selecting a single option.
  4. Multi-Select: Dropdown menu for selecting multiple options.
  5. Radio List: List of radio buttons for selecting a single option.
  6. Select Image: List of images for selecting one or more options.

Single Checkbox

Add a single checkbox field into the form and go to its settings. Under the advanced option, you’ll find boxes for checked and unchecked calculation values where you can set numeric values.

Checkbox List

Please select the checkbox list and go to its settings. Under the options, you can add a label and its corresponding calculation value that will be used for the calculation.

Select List

A select list allows you to choose only one value. To add a label and calculation value to a select list, select it and go to its settings.

Multi-Select

A multi-select list allows you to choose multiple values. To add a label and calculation value to a multi-select list, select it and go to its settings.

Radio List

The radio list allows you to choose a single value at a time. To add a label and calculation value to the radio list, select it and go to its settings.

Select Image

You can add functionality to calculate with the image selection. Ninja Forms plugin allows the user to enable/disable multiple selections in the select image option. You can add a label, calculation value, and images.

Calculate Fields in Ninja Forms

You need to add fields that have numeric input or calculation values to the form. You can review the fields (numeric input and calculation value) above. Go to the dashboard of Ninja Forms, click on the gear icon for the editing, or click on the ADD NEW button to create a new form.

Add fields in the forms according to your requirements. Go to the advanced menu, select the calculations button then you can see the settings of the calculations in the Ninja Forms.

Create a Variable Name that will show output on the screen in the form. Click on the toggle button in the Equation section and select fields that have values. Use the unary plus(+) operator to add fields then you can use this variable in the form to show output.

Go to the form fields menu and add an HTML field to the form. You can add a label for the HTML field, select a variable in the editor, and insert text.

Here we used three options and one numeric input field, each with a value in the field. All fields currently have a zero value instead of the correct answers. When I select the correct answer, the number will be added to the total count variable and displayed on the screen. Additionally, set the minimum and maximum values for the numeric input field (Number), which will be included in the total count after entering the number.

The correct answer is worth 5 points, while the wrong answer is worth 0 points.

Leave a Reply

Your email address will not be published. Required fields are marked *

Optionally add an image (JPEG only)